diff --git a/src/builtin/selector.rs b/src/builtin/selector.rs index 4015796..dae2d00 100644 --- a/src/builtin/selector.rs +++ b/src/builtin/selector.rs @@ -33,7 +33,7 @@ fn simple_selectors(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult vals.extend(self.parse_stmt(rule)?), - Stmt::Style(s) => vals.get_mut(0).unwrap().push_style(s), - Stmt::Comment(s) => vals.get_mut(0).unwrap().push_comment(s), + Stmt::Style(s) => vals.first_mut().unwrap().push_style(s), + Stmt::Comment(s) => vals.first_mut().unwrap().push_comment(s), Stmt::Media(m) => { let MediaRule { query, body, .. } = *m; vals.push(Toplevel::Media { query, body }) @@ -167,7 +167,7 @@ impl Css { k @ Stmt::KeyframesRuleSet(..) => { unreachable!("@keyframes ruleset {:?}", k) } - Stmt::Import(s) => vals.get_mut(0).unwrap().push_import(s), + Stmt::Import(s) => vals.first_mut().unwrap().push_import(s), }; } vals @@ -204,7 +204,7 @@ impl Css { let mut vals = vec![Toplevel::new_keyframes_rule(selector)]; for rule in body { match rule { - Stmt::Style(s) => vals.get_mut(0).unwrap().push_style(s), + Stmt::Style(s) => vals.first_mut().unwrap().push_style(s), Stmt::KeyframesRuleSet(..) => vals.extend(self.parse_stmt(rule)?), _ => todo!(), } @@ -221,7 +221,7 @@ impl Css { // this is how we print newlines between unrelated styles // it could probably be refactored if !v.is_empty() { - if let Some(Toplevel::MultilineComment(..)) = v.get(0) { + if let Some(Toplevel::MultilineComment(..)) = v.first() { } else if is_first { is_first = false; } else { diff --git a/src/parse/value/parse.rs b/src/parse/value/parse.rs index 29ee79c..6a9dba1 100644 --- a/src/parse/value/parse.rs +++ b/src/parse/value/parse.rs @@ -105,7 +105,7 @@ impl<'a> Parser<'a> { comma_separated.push(space_separated.pop().unwrap()); } else { let mut span = space_separated - .get(0) + .first() .ok_or(("Expected expression.", val.span))? .span; comma_separated.push( diff --git a/src/selector/parse.rs b/src/selector/parse.rs index 9c52257..cc7c001 100644 --- a/src/selector/parse.rs +++ b/src/selector/parse.rs @@ -561,7 +561,7 @@ fn is_simple_selector_start(c: char) -> bool { /// with pseudo-class syntax (`:before`, `:after`, `:first-line`, or /// `:first-letter`) fn is_fake_pseudo_element(name: &str) -> bool { - match name.as_bytes().get(0) { + match name.as_bytes().first() { Some(b'a') | Some(b'A') => name.to_ascii_lowercase() == "after", Some(b'b') | Some(b'B') => name.to_ascii_lowercase() == "before", Some(b'f') | Some(b'F') => match name.to_ascii_lowercase().as_str() { diff --git a/src/selector/simple.rs b/src/selector/simple.rs index 82ae23a..fb1c6b5 100644 --- a/src/selector/simple.rs +++ b/src/selector/simple.rs @@ -364,7 +364,7 @@ impl SimpleSelector { }; complex .components - .get(0) + .first() .unwrap() .as_compound() .components