Reducing boxing and sizes of Expr/Stmt.

This commit is contained in:
Stephen Chung
2020-05-09 21:46:38 +08:00
parent 17e4adc049
commit a7bfac21bd
5 changed files with 851 additions and 891 deletions

View File

@@ -206,14 +206,14 @@ pub enum Token {
impl Token {
/// Get the syntax of the token.
pub fn syntax(&self) -> Cow<str> {
pub fn syntax(&self) -> Cow<'static, str> {
use Token::*;
match self {
IntegerConstant(i) => i.to_string().into(),
#[cfg(not(feature = "no_float"))]
FloatConstant(f) => f.to_string().into(),
Identifier(s) => s.into(),
Identifier(s) => s.clone().into(),
CharConstant(c) => c.to_string().into(),
LexError(err) => err.to_string().into(),