Remove unused TokenKind variant

This commit is contained in:
ConnorSkees 2020-01-11 19:39:42 -05:00
parent 316156106a
commit 42d0fa657f
2 changed files with 6 additions and 6 deletions

View File

@ -157,6 +157,8 @@ pub enum Color {
impl fmt::UpperHex for Color { impl fmt::UpperHex for Color {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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 { match self {
Self::AliceBlue => write!(f, "#F0F8FF"), Self::AliceBlue => write!(f, "#F0F8FF"),
Self::AntiqueWhite => write!(f, "#FAEBD7"), Self::AntiqueWhite => write!(f, "#FAEBD7"),

View File

@ -72,7 +72,6 @@ pub enum TokenKind {
Whitespace(Whitespace), Whitespace(Whitespace),
Variable(String), Variable(String),
Attribute(Attribute), Attribute(Attribute),
Style(Vec<Token>),
Op(Op), Op(Op),
MultilineComment(String), MultilineComment(String),
} }
@ -91,7 +90,6 @@ impl Display for TokenKind {
TokenKind::Keyword(kw) => write!(f, "{}", kw), TokenKind::Keyword(kw) => write!(f, "{}", kw),
TokenKind::MultilineComment(s) => write!(f, "/*{}*/", s), TokenKind::MultilineComment(s) => write!(f, "/*{}*/", s),
TokenKind::Variable(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; continue;
} }
TokenKind::Variable(name) => { TokenKind::Variable(name) => {
let Token { ref pos, .. } = self let Token { pos, .. } = self
.lexer .lexer
.next() .next()
.expect("this cannot occur as we have already peeked"); .expect("this cannot occur as we have already peeked");
@ -243,7 +241,7 @@ impl<'a> StyleSheetParser<'a> {
fn eat_at_rule(&mut self) { fn eat_at_rule(&mut self) {
if let Some(Token { if let Some(Token {
kind: TokenKind::AtRule(ref rule), kind: TokenKind::AtRule(ref rule),
ref pos, pos,
}) = self.lexer.next() }) = self.lexer.next()
{ {
match rule { 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!("Error: {}", message);
eprintln!( eprintln!(
"{} {}:{} scope on line {} at column {}", "{} {}:{} scope on line {} at column {}",
@ -298,7 +296,7 @@ impl<'a> StyleSheetParser<'a> {
for tok in iter1 { for tok in iter1 {
if let Token { if let Token {
kind: TokenKind::Variable(ref name), kind: TokenKind::Variable(ref name),
ref pos, pos,
} = tok } = tok
{ {
iter2.extend( iter2.extend(