From de68f3f3753018a4e31ff13b5259c60c2b49a677 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Sun, 19 May 2024 03:42:21 +0000 Subject: [PATCH] clippy --- crates/compiler/src/ast/stmt.rs | 2 +- crates/compiler/src/builtin/modules/math.rs | 2 +- crates/compiler/src/evaluate/visitor.rs | 12 +++++------- crates/compiler/src/selector/extend/functions.rs | 8 ++++---- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/crates/compiler/src/ast/stmt.rs b/crates/compiler/src/ast/stmt.rs index 64a2713..fe3a3a8 100644 --- a/crates/compiler/src/ast/stmt.rs +++ b/crates/compiler/src/ast/stmt.rs @@ -348,7 +348,7 @@ impl Configuration { } pub fn first(&self) -> Option> { - let name = *self.values.keys().get(0)?; + let name = *self.values.keys().first()?; let value = self.values.get(name)?; Some(Spanned { diff --git a/crates/compiler/src/builtin/modules/math.rs b/crates/compiler/src/builtin/modules/math.rs index a52d1d1..1f816c7 100644 --- a/crates/compiler/src/builtin/modules/math.rs +++ b/crates/compiler/src/builtin/modules/math.rs @@ -481,7 +481,7 @@ pub(crate) fn declare(f: &mut Module) { ); f.insert_builtin_var( "epsilon", - Value::Dimension(SassNumber::new_unitless(std::f64::EPSILON)), + Value::Dimension(SassNumber::new_unitless(f64::EPSILON)), ); f.insert_builtin_var( "max-safe-integer", diff --git a/crates/compiler/src/evaluate/visitor.rs b/crates/compiler/src/evaluate/visitor.rs index 234ab4f..248778d 100644 --- a/crates/compiler/src/evaluate/visitor.rs +++ b/crates/compiler/src/evaluate/visitor.rs @@ -337,7 +337,7 @@ impl<'a> Visitor<'a> { config: Arc>, forward_rule: &AstForwardRule, ) -> SassResult>> { - let mut new_values = BTreeMap::from_iter((*config).borrow().values.iter().into_iter()); + let mut new_values = BTreeMap::from_iter((*config).borrow().values.iter()); for variable in &forward_rule.configuration { if variable.is_guarded { @@ -1386,9 +1386,9 @@ impl<'a> Visitor<'a> { Some(merged_queries) if merged_queries.is_empty() => return Ok(None), Some(..) => { let mut set = IndexSet::new(); - set.extend(self.media_query_sources.clone().unwrap().into_iter()); - set.extend(self.media_queries.clone().unwrap().into_iter()); - set.extend(queries1.clone().into_iter()); + set.extend(self.media_query_sources.clone().unwrap()); + set.extend(self.media_queries.clone().unwrap()); + set.extend(queries1.clone()); set } None => IndexSet::new(), @@ -2626,9 +2626,7 @@ impl<'a> Visitor<'a> { as_slash, }), Value::Calculation(calc) => CalculationArg::Calculation(calc), - Value::String(s, quotes) if quotes == QuoteKind::None => { - CalculationArg::String(s) - } + Value::String(s, QuoteKind::None) => CalculationArg::String(s), value => { return Err(( format!( diff --git a/crates/compiler/src/selector/extend/functions.rs b/crates/compiler/src/selector/extend/functions.rs index 878ab4b..5670c1b 100644 --- a/crates/compiler/src/selector/extend/functions.rs +++ b/crates/compiler/src/selector/extend/functions.rs @@ -186,7 +186,7 @@ fn weave_parents( choices.push( chunks(&mut groups_one, &mut groups_two, |sequence| { complex_is_parent_superselector( - match sequence.get(0) { + match sequence.front() { Some(v) => v.clone(), None => return true, }, @@ -235,14 +235,14 @@ fn merge_initial_combinators( ) -> Option> { let mut combinators_one: Vec = Vec::new(); - while let Some(ComplexSelectorComponent::Combinator(c)) = components_one.get(0) { + while let Some(ComplexSelectorComponent::Combinator(c)) = components_one.front() { combinators_one.push(*c); components_one.pop_front(); } let mut combinators_two = Vec::new(); - while let Some(ComplexSelectorComponent::Combinator(c)) = components_two.get(0) { + while let Some(ComplexSelectorComponent::Combinator(c)) = components_two.front() { combinators_two.push(*c); components_two.pop_front(); } @@ -565,7 +565,7 @@ fn first_if_root(queue: &mut VecDeque) -> Option