diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 68e7e40c43efe..d90ec4ea081b2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1956,7 +1956,7 @@ impl<'a> Parser<'a> { if suffix_illegal { let sp = self.span; - self.expect_no_suffix(sp, &format!("{} literal", lit.short_name()), suf) + self.expect_no_suffix(sp, lit.literal_name(), suf) } result.unwrap() diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 01bc7f6ad302b..1c6fc1ac1853f 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -79,14 +79,14 @@ pub enum Lit { } impl Lit { - crate fn short_name(&self) -> &'static str { + crate fn literal_name(&self) -> &'static str { match *self { - Byte(_) => "byte", - Char(_) => "char", - Integer(_) => "integer", - Float(_) => "float", - Str_(_) | StrRaw(..) => "string", - ByteStr(_) | ByteStrRaw(..) => "byte string" + Byte(_) => "byte literal", + Char(_) => "char literal", + Integer(_) => "integer literal", + Float(_) => "float literal", + Str_(_) | StrRaw(..) => "string literal", + ByteStr(_) | ByteStrRaw(..) => "byte string literal" } }