diff --git a/src/fallback.rs b/src/fallback.rs index b42537b..2d1c991 100644 --- a/src/fallback.rs +++ b/src/fallback.rs @@ -781,7 +781,7 @@ impl Debug for Group { #[derive(Clone)] pub(crate) struct Ident { - sym: String, + sym: Box, span: Span, raw: bool, } @@ -795,7 +795,7 @@ impl Ident { pub fn new_unchecked(string: &str, span: Span) -> Self { Ident { - sym: string.to_owned(), + sym: Box::from(string), span, raw: false, } @@ -809,7 +809,7 @@ impl Ident { pub fn new_raw_unchecked(string: &str, span: Span) -> Self { Ident { - sym: string.to_owned(), + sym: Box::from(string), span, raw: true, } @@ -886,9 +886,9 @@ where fn eq(&self, other: &T) -> bool { let other = other.as_ref(); if self.raw { - other.starts_with("r#") && self.sym == other[2..] + other.starts_with("r#") && *self.sym == other[2..] } else { - self.sym == other + *self.sym == *other } } } diff --git a/tests/test_size.rs b/tests/test_size.rs index 44900d5..7b07390 100644 --- a/tests/test_size.rs +++ b/tests/test_size.rs @@ -22,7 +22,7 @@ fn test_proc_macro2_fallback_size_without_locations() { assert_eq!(mem::size_of::(), 0); assert_eq!(mem::size_of::>(), 1); assert_eq!(mem::size_of::(), 16); - assert_eq!(mem::size_of::(), 32); + assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 8); assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 8); @@ -34,7 +34,7 @@ fn test_proc_macro2_fallback_size_with_locations() { assert_eq!(mem::size_of::(), 8); assert_eq!(mem::size_of::>(), 12); assert_eq!(mem::size_of::(), 24); - assert_eq!(mem::size_of::(), 40); + assert_eq!(mem::size_of::(), 32); assert_eq!(mem::size_of::(), 16); assert_eq!(mem::size_of::(), 32); assert_eq!(mem::size_of::(), 8); @@ -50,7 +50,7 @@ fn test_proc_macro2_wrapper_size_without_locations() { assert_eq!(mem::size_of::(), 4); assert_eq!(mem::size_of::>(), 8); assert_eq!(mem::size_of::(), 24); - assert_eq!(mem::size_of::(), 32); + assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 12); assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 32); @@ -66,7 +66,7 @@ fn test_proc_macro2_wrapper_size_with_locations() { assert_eq!(mem::size_of::(), 12); assert_eq!(mem::size_of::>(), 12); assert_eq!(mem::size_of::(), 32); - assert_eq!(mem::size_of::(), 40); + assert_eq!(mem::size_of::(), 32); assert_eq!(mem::size_of::(), 20); assert_eq!(mem::size_of::(), 32); assert_eq!(mem::size_of::(), 32);