diff options
| author | Seo Sanghyeon <sanxiyn@gmail.com> | 2013-05-24 01:09:11 +0900 |
|---|---|---|
| committer | Seo Sanghyeon <sanxiyn@gmail.com> | 2013-05-28 03:14:44 +0900 |
| commit | 8f80323f09ef150efc5cf729100f99981afc96e1 (patch) | |
| tree | 146beb099875fb28ff9eae1d4b5a72b6b624b3c3 /src/libsyntax/parse/token.rs | |
| parent | 363e67273622285a65caa74bb63ecfa04df59055 (diff) | |
| download | rust-8f80323f09ef150efc5cf729100f99981afc96e1.tar.gz rust-8f80323f09ef150efc5cf729100f99981afc96e1.zip | |
Remove unnecessary allocations flagged by lint
Diffstat (limited to 'src/libsyntax/parse/token.rs')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 56b1ed5d5c7..c43924486e7 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -138,7 +138,7 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str { OROR => ~"||", ANDAND => ~"&&", BINOP(op) => binop_to_str(op), - BINOPEQ(op) => binop_to_str(op) + ~"=", + BINOPEQ(op) => binop_to_str(op) + "=", /* Structural symbols */ AT => ~"@", @@ -163,7 +163,7 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str { /* Literals */ LIT_INT(c, ast::ty_char) => { - ~"'" + char::escape_default(c as char) + ~"'" + ~"'" + char::escape_default(c as char) + "'" } LIT_INT(i, t) => { i.to_str() + ast_util::int_ty_to_str(t) @@ -175,18 +175,18 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str { LIT_FLOAT(s, t) => { let mut body = copy *in.get(s); if body.ends_with(".") { - body = body + ~"0"; // `10.f` is not a float literal + body += "0"; // `10.f` is not a float literal } body + ast_util::float_ty_to_str(t) } LIT_FLOAT_UNSUFFIXED(s) => { let mut body = copy *in.get(s); if body.ends_with(".") { - body = body + ~"0"; // `10.f` is not a float literal + body += "0"; // `10.f` is not a float literal } body } - LIT_STR(s) => { ~"\"" + str::escape_default(*in.get(s)) + ~"\"" } + LIT_STR(s) => { ~"\"" + str::escape_default(*in.get(s)) + "\"" } /* Name components */ IDENT(s, _) => copy *in.get(s), |
