resolve clippy lints

This commit is contained in:
ConnorSkees 2020-06-23 04:20:13 -04:00
parent 84328f0e2c
commit 173a896ab0
2 changed files with 13 additions and 5 deletions

View File

@ -6,9 +6,17 @@ use std::{
use crate::selector::{Selector, SelectorList}; use crate::selector::{Selector, SelectorList};
#[derive(Debug, Clone, Eq, PartialEq)] #[derive(Debug, Clone)]
pub(crate) struct ExtendedSelector(Rc<RefCell<SelectorList>>); pub(crate) struct ExtendedSelector(Rc<RefCell<SelectorList>>);
impl PartialEq for ExtendedSelector {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
impl Eq for ExtendedSelector {}
impl Hash for ExtendedSelector { impl Hash for ExtendedSelector {
fn hash<H: Hasher>(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
self.0.borrow().hash(state); self.0.borrow().hash(state);

View File

@ -875,13 +875,13 @@ impl Extender {
.replace(&mut media_query_context); .replace(&mut media_query_context);
} }
let extended_selector = ExtendedSelector::new(selector.clone()); let extended_selector = ExtendedSelector::new(selector.clone());
self.register_selector(selector, extended_selector.clone()); self.register_selector(selector, &extended_selector);
extended_selector extended_selector
} }
/// Registers the `SimpleSelector`s in `list` to point to `selector` in /// Registers the `SimpleSelector`s in `list` to point to `selector` in
/// `self.selectors`. /// `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 complex in list.components {
for component in complex.components { for component in complex.components {
if let ComplexSelectorComponent::Compound(component) = component { if let ComplexSelectorComponent::Compound(component) = component {
@ -896,7 +896,7 @@ impl Extender {
.. ..
}) = simple }) = 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 { if old_value == selector_as_selector {
continue; continue;
} }
self.register_selector(selector_as_selector, selector); self.register_selector(selector_as_selector, &selector);
} }
} }
} }