diff --git a/src/parse/value/parse.rs b/src/parse/value/parse.rs index 6a9dba1..3c66b6e 100644 --- a/src/parse/value/parse.rs +++ b/src/parse/value/parse.rs @@ -594,7 +594,7 @@ impl<'a> Parser<'a> { self.toks.next(); self.whitespace_or_comment(); - if let Some(Token { kind: ']', pos }) = self.toks.peek() { + if let Some(Token { kind: ']', pos }) = self.toks.peek() { span = span.merge(*pos); self.toks.next(); IntermediateValue::Value(HigherIntermediateValue::Literal(Value::List( diff --git a/src/selector/extend/functions.rs b/src/selector/extend/functions.rs index 548173a..1ee8d94 100644 --- a/src/selector/extend/functions.rs +++ b/src/selector/extend/functions.rs @@ -346,16 +346,8 @@ fn merge_final_combinators( ) -> Option>>> { let mut result = result.unwrap_or_default(); - if (components_one.is_empty() - || !components_one - .get(components_one.len() - 1) - .unwrap() - .is_combinator()) - && (components_two.is_empty() - || !components_two - .get(components_two.len() - 1) - .unwrap() - .is_combinator()) + if (components_one.is_empty() || !components_one.back().unwrap().is_combinator()) + && (components_two.is_empty() || !components_two.back().unwrap().is_combinator()) { return Some(Vec::from(result)); } @@ -539,12 +531,8 @@ fn merge_final_combinators( } (Some(combinator_one), None) => { if *combinator_one == Combinator::Child && !components_two.is_empty() { - if let Some(ComplexSelectorComponent::Compound(c1)) = - components_one.get(components_one.len() - 1) - { - if let Some(ComplexSelectorComponent::Compound(c2)) = - components_two.get(components_two.len() - 1) - { + if let Some(ComplexSelectorComponent::Compound(c1)) = components_one.back() { + if let Some(ComplexSelectorComponent::Compound(c2)) = components_two.back() { if c2.is_super_selector(c1, &None) { components_two.pop_back(); } @@ -561,12 +549,8 @@ fn merge_final_combinators( } (None, Some(combinator_two)) => { if *combinator_two == Combinator::Child && !components_one.is_empty() { - if let Some(ComplexSelectorComponent::Compound(c1)) = - components_one.get(components_one.len() - 1) - { - if let Some(ComplexSelectorComponent::Compound(c2)) = - components_two.get(components_two.len() - 1) - { + if let Some(ComplexSelectorComponent::Compound(c1)) = components_one.back() { + if let Some(ComplexSelectorComponent::Compound(c2)) = components_two.back() { if c1.is_super_selector(c2, &None) { components_one.pop_back(); }