diff --git a/src/selectors_vm/ast.rs b/src/selectors_vm/ast.rs index 45ba94da..a18f17c4 100644 --- a/src/selectors_vm/ast.rs +++ b/src/selectors_vm/ast.rs @@ -49,15 +49,15 @@ impl NthChild { pub(crate) enum OnTagNameExpr { ExplicitAny, Unmatchable, - LocalName(String), + LocalName(Box), NthChild(NthChild), NthOfType(NthChild), } #[derive(Eq, PartialEq)] pub(crate) struct AttributeComparisonExpr { - pub name: String, - pub value: String, + pub name: Box, + pub value: Box, pub case_sensitivity: ParsedCaseSensitivity, pub operator: AttrSelectorOperator, } @@ -66,8 +66,8 @@ impl AttributeComparisonExpr { #[inline] #[must_use] pub const fn new( - name: String, - value: String, + name: Box, + value: Box, case_sensitivity: ParsedCaseSensitivity, operator: AttrSelectorOperator, ) -> Self { @@ -105,9 +105,9 @@ impl Debug for AttributeComparisonExpr { /// An attribute check when attributes are received and parsed. #[derive(PartialEq, Eq, Debug)] pub(crate) enum OnAttributesExpr { - Id(String), - Class(String), - AttributeExists(String), + Id(Box), + Class(Box), + AttributeExists(Box), AttributeComparisonExpr(AttributeComparisonExpr), } diff --git a/src/selectors_vm/parser.rs b/src/selectors_vm/parser.rs index f0723f19..3b2421df 100644 --- a/src/selectors_vm/parser.rs +++ b/src/selectors_vm/parser.rs @@ -12,20 +12,17 @@ use std::str::FromStr; pub(crate) struct SelectorImplDescriptor; #[derive(Clone, Default, Eq, PartialEq)] -pub struct CssString(pub String); +pub struct CssString(pub Box); impl<'a> From<&'a str> for CssString { fn from(value: &'a str) -> Self { - Self(value.to_string()) + Self(value.into()) } } impl ToCss for CssString { - fn to_css(&self, dest: &mut W) -> fmt::Result - where - W: fmt::Write, - { - write!(dest, "{}", self.0) + fn to_css(&self, dest: &mut W) -> fmt::Result { + dest.write_str(&self.0) } }