Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
connorskees committed May 19, 2024
1 parent c494abc commit de68f3f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion crates/compiler/src/ast/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl Configuration {
}

pub fn first(&self) -> Option<Spanned<Identifier>> {
let name = *self.values.keys().get(0)?;
let name = *self.values.keys().first()?;
let value = self.values.get(name)?;

Some(Spanned {
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/src/builtin/modules/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 5 additions & 7 deletions crates/compiler/src/evaluate/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl<'a> Visitor<'a> {
config: Arc<RefCell<Configuration>>,
forward_rule: &AstForwardRule,
) -> SassResult<Arc<RefCell<Configuration>>> {
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 {
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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!(
Expand Down
8 changes: 4 additions & 4 deletions crates/compiler/src/selector/extend/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -235,14 +235,14 @@ fn merge_initial_combinators(
) -> Option<Vec<Combinator>> {
let mut combinators_one: Vec<Combinator> = 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();
}
Expand Down Expand Up @@ -565,7 +565,7 @@ fn first_if_root(queue: &mut VecDeque<ComplexSelectorComponent>) -> Option<Compo
if queue.is_empty() {
return None;
}
if let Some(ComplexSelectorComponent::Compound(c)) = queue.get(0) {
if let Some(ComplexSelectorComponent::Compound(c)) = queue.front() {
if !has_root(c) {
return None;
}
Expand Down

0 comments on commit de68f3f

Please sign in to comment.