Skip to content

Commit

Permalink
token: simplify TokenKind::Str printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Fedotov committed Feb 17, 2024
1 parent 61b4adc commit 09f3992
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions compiler/hash-token/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,7 @@ impl TokenKind {
match self {
TokenKind::Unexpected(atom) => format!("an unknown character `{atom}`"),
TokenKind::Char(ch) => format!("`{ch}`"),
TokenKind::Str(str) => {
let value = str.to_str();
format!("the string `{}`", value)
}
TokenKind::Str(alloc) => format!("the string `{}`", alloc.to_str()),
TokenKind::Keyword(kwd) => format!("the keyword `{kwd}`"),
TokenKind::Ident(ident) => format!("the identifier `{}`", *ident),
kind => format!("a `{kind}`"),
Expand Down

0 comments on commit 09f3992

Please sign in to comment.