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>> { 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)?; let value = self.values.get(name)?;
Some(Spanned { Some(Spanned {

View File

@ -481,7 +481,7 @@ pub(crate) fn declare(f: &mut Module) {
); );
f.insert_builtin_var( f.insert_builtin_var(
"epsilon", "epsilon",
Value::Dimension(SassNumber::new_unitless(std::f64::EPSILON)), Value::Dimension(SassNumber::new_unitless(f64::EPSILON)),
); );
f.insert_builtin_var( f.insert_builtin_var(
"max-safe-integer", "max-safe-integer",

View File

@ -337,7 +337,7 @@ impl<'a> Visitor<'a> {
config: Arc<RefCell<Configuration>>, config: Arc<RefCell<Configuration>>,
forward_rule: &AstForwardRule, forward_rule: &AstForwardRule,
) -> SassResult<Arc<RefCell<Configuration>>> { ) -> 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 { for variable in &forward_rule.configuration {
if variable.is_guarded { if variable.is_guarded {
@ -1386,9 +1386,9 @@ impl<'a> Visitor<'a> {
Some(merged_queries) if merged_queries.is_empty() => return Ok(None), Some(merged_queries) if merged_queries.is_empty() => return Ok(None),
Some(..) => { Some(..) => {
let mut set = IndexSet::new(); let mut set = IndexSet::new();
set.extend(self.media_query_sources.clone().unwrap().into_iter()); set.extend(self.media_query_sources.clone().unwrap());
set.extend(self.media_queries.clone().unwrap().into_iter()); set.extend(self.media_queries.clone().unwrap());
set.extend(queries1.clone().into_iter()); set.extend(queries1.clone());
set set
} }
None => IndexSet::new(), None => IndexSet::new(),
@ -2626,9 +2626,7 @@ impl<'a> Visitor<'a> {
as_slash, as_slash,
}), }),
Value::Calculation(calc) => CalculationArg::Calculation(calc), Value::Calculation(calc) => CalculationArg::Calculation(calc),
Value::String(s, quotes) if quotes == QuoteKind::None => { Value::String(s, QuoteKind::None) => CalculationArg::String(s),
CalculationArg::String(s)
}
value => { value => {
return Err(( return Err((
format!( format!(

View File

@ -186,7 +186,7 @@ fn weave_parents(
choices.push( choices.push(
chunks(&mut groups_one, &mut groups_two, |sequence| { chunks(&mut groups_one, &mut groups_two, |sequence| {
complex_is_parent_superselector( complex_is_parent_superselector(
match sequence.get(0) { match sequence.front() {
Some(v) => v.clone(), Some(v) => v.clone(),
None => return true, None => return true,
}, },
@ -235,14 +235,14 @@ fn merge_initial_combinators(
) -> Option<Vec<Combinator>> { ) -> Option<Vec<Combinator>> {
let mut combinators_one: Vec<Combinator> = Vec::new(); 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); combinators_one.push(*c);
components_one.pop_front(); components_one.pop_front();
} }
let mut combinators_two = Vec::new(); 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); combinators_two.push(*c);
components_two.pop_front(); components_two.pop_front();
} }
@ -565,7 +565,7 @@ fn first_if_root(queue: &mut VecDeque<ComplexSelectorComponent>) -> Option<Compo
if queue.is_empty() { if queue.is_empty() {
return None; return None;
} }
if let Some(ComplexSelectorComponent::Compound(c)) = queue.get(0) { if let Some(ComplexSelectorComponent::Compound(c)) = queue.front() {
if !has_root(c) { if !has_root(c) {
return None; return None;
} }