This commit is contained in:
Connor Skees 2024-05-19 03:42:21 +00:00
parent c494abc78e
commit de68f3f375
4 changed files with 11 additions and 13 deletions

View File

@ -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 {

View File

@ -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",

View File

@ -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 {
@ -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!(

View File

@ -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<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();
}
@ -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;
}