diff --git a/src/color.rs b/src/color.rs index 868773e..4244d37 100644 --- a/src/color.rs +++ b/src/color.rs @@ -157,6 +157,8 @@ pub enum Color { impl fmt::UpperHex for Color { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + // I want them all to be on separate lines so doing things with regex or multiple cursors is easier + #[allow(clippy::match_same_arms)] match self { Self::AliceBlue => write!(f, "#F0F8FF"), Self::AntiqueWhite => write!(f, "#FAEBD7"), diff --git a/src/main.rs b/src/main.rs index 4ef6a7b..93c0344 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,7 +72,6 @@ pub enum TokenKind { Whitespace(Whitespace), Variable(String), Attribute(Attribute), - Style(Vec), Op(Op), MultilineComment(String), } @@ -91,7 +90,6 @@ impl Display for TokenKind { TokenKind::Keyword(kw) => write!(f, "{}", kw), TokenKind::MultilineComment(s) => write!(f, "/*{}*/", s), TokenKind::Variable(s) => write!(f, "${}", s), - TokenKind::Style(_) => panic!("TokenKind should not be used to format styles"), } } } @@ -212,7 +210,7 @@ impl<'a> StyleSheetParser<'a> { continue; } TokenKind::Variable(name) => { - let Token { ref pos, .. } = self + let Token { pos, .. } = self .lexer .next() .expect("this cannot occur as we have already peeked"); @@ -243,7 +241,7 @@ impl<'a> StyleSheetParser<'a> { fn eat_at_rule(&mut self) { if let Some(Token { kind: TokenKind::AtRule(ref rule), - ref pos, + pos, }) = self.lexer.next() { match rule { @@ -262,7 +260,7 @@ impl<'a> StyleSheetParser<'a> { } } - fn error(&self, pos: &Pos, message: &str) -> ! { + fn error(&self, pos: Pos, message: &str) -> ! { eprintln!("Error: {}", message); eprintln!( "{} {}:{} scope on line {} at column {}", @@ -298,7 +296,7 @@ impl<'a> StyleSheetParser<'a> { for tok in iter1 { if let Token { kind: TokenKind::Variable(ref name), - ref pos, + pos, } = tok { iter2.extend(