diff --git a/src/selector/extend/extended_selector.rs b/src/selector/extend/extended_selector.rs index 9c33a2d..1f54a43 100644 --- a/src/selector/extend/extended_selector.rs +++ b/src/selector/extend/extended_selector.rs @@ -6,9 +6,17 @@ use std::{ use crate::selector::{Selector, SelectorList}; -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone)] pub(crate) struct ExtendedSelector(Rc>); +impl PartialEq for ExtendedSelector { + fn eq(&self, other: &Self) -> bool { + self.0 == other.0 + } +} + +impl Eq for ExtendedSelector {} + impl Hash for ExtendedSelector { fn hash(&self, state: &mut H) { self.0.borrow().hash(state); diff --git a/src/selector/extend/mod.rs b/src/selector/extend/mod.rs index 62c2a46..8e293f6 100644 --- a/src/selector/extend/mod.rs +++ b/src/selector/extend/mod.rs @@ -875,13 +875,13 @@ impl Extender { .replace(&mut media_query_context); } let extended_selector = ExtendedSelector::new(selector.clone()); - self.register_selector(selector, extended_selector.clone()); + self.register_selector(selector, &extended_selector); extended_selector } /// Registers the `SimpleSelector`s in `list` to point to `selector` in /// `self.selectors`. - fn register_selector(&mut self, list: SelectorList, selector: ExtendedSelector) { + fn register_selector(&mut self, list: SelectorList, selector: &ExtendedSelector) { for complex in list.components { for component in complex.components { if let ComplexSelectorComponent::Compound(component) = component { @@ -896,7 +896,7 @@ impl Extender { .. }) = simple { - self.register_selector(simple_selector, selector.clone()); + self.register_selector(simple_selector, selector); } } } @@ -1145,7 +1145,7 @@ impl Extender { if old_value == selector_as_selector { continue; } - self.register_selector(selector_as_selector, selector); + self.register_selector(selector_as_selector, &selector); } } }