about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorSeo Sanghyeon <sanxiyn@gmail.com>2013-05-24 01:09:11 +0900
committerSeo Sanghyeon <sanxiyn@gmail.com>2013-05-28 03:14:44 +0900
commit8f80323f09ef150efc5cf729100f99981afc96e1 (patch)
tree146beb099875fb28ff9eae1d4b5a72b6b624b3c3 /src/libsyntax/parse
parent363e67273622285a65caa74bb63ecfa04df59055 (diff)
downloadrust-8f80323f09ef150efc5cf729100f99981afc96e1.tar.gz
rust-8f80323f09ef150efc5cf729100f99981afc96e1.zip
Remove unnecessary allocations flagged by lint
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/attr.rs12
-rw-r--r--src/libsyntax/parse/comments.rs6
-rw-r--r--src/libsyntax/parse/common.rs4
-rw-r--r--src/libsyntax/parse/lexer.rs2
-rw-r--r--src/libsyntax/parse/parser.rs6
-rw-r--r--src/libsyntax/parse/token.rs10
6 files changed, 20 insertions, 20 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index d947fa43ca7..ed9a83d6b1e 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -42,7 +42,7 @@ impl parser_attr for Parser {
                 if self.look_ahead(1u) != token::LBRACKET {
                     break;
                 }
-                attrs += ~[self.parse_attribute(ast::attr_outer)];
+                attrs += [self.parse_attribute(ast::attr_outer)];
               }
               token::DOC_COMMENT(s) => {
                 let attr = ::attr::mk_sugared_doc_attr(
@@ -53,7 +53,7 @@ impl parser_attr for Parser {
                 if attr.node.style != ast::attr_outer {
                   self.fatal("expected outer comment");
                 }
-                attrs += ~[attr];
+                attrs += [attr];
                 self.bump();
               }
               _ => break
@@ -105,7 +105,7 @@ impl parser_attr for Parser {
                 let attr = self.parse_attribute(ast::attr_inner);
                 if *self.token == token::SEMI {
                     self.bump();
-                    inner_attrs += ~[attr];
+                    inner_attrs += [attr];
                 } else {
                     // It's not really an inner attribute
                     let outer_attr =
@@ -113,7 +113,7 @@ impl parser_attr for Parser {
                             ast::attribute_ { style: ast::attr_outer,
                                               value: attr.node.value,
                                               is_sugared_doc: false });
-                    next_outer_attrs += ~[outer_attr];
+                    next_outer_attrs += [outer_attr];
                     break;
                 }
               }
@@ -125,9 +125,9 @@ impl parser_attr for Parser {
                 );
                 self.bump();
                 if attr.node.style == ast::attr_inner {
-                  inner_attrs += ~[attr];
+                  inner_attrs += [attr];
                 } else {
-                  next_outer_attrs += ~[attr];
+                  next_outer_attrs += [attr];
                   break;
                 }
               }
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 66d2d46cc58..3fa0fa3b0f0 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -235,7 +235,7 @@ fn read_block_comment(rdr: @mut StringReader,
             bump(rdr);
         }
         if !is_eof(rdr) {
-            curr_line += ~"*/";
+            curr_line += "*/";
             bump(rdr);
             bump(rdr);
         }
@@ -259,13 +259,13 @@ fn read_block_comment(rdr: @mut StringReader,
                 if rdr.curr == '/' && nextch(rdr) == '*' {
                     bump(rdr);
                     bump(rdr);
-                    curr_line += ~"*";
+                    curr_line += "*";
                     level += 1;
                 } else {
                     if rdr.curr == '*' && nextch(rdr) == '/' {
                         bump(rdr);
                         bump(rdr);
-                        curr_line += ~"/";
+                        curr_line += "/";
                         level -= 1;
                     } else { bump(rdr); }
                 }
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs
index 6a868fbf173..bdbe91e4112 100644
--- a/src/libsyntax/parse/common.rs
+++ b/src/libsyntax/parse/common.rs
@@ -194,9 +194,9 @@ pub impl Parser {
         } else {
             let mut s: ~str = ~"expected `";
             s += self.token_to_str(&token::GT);
-            s += ~"`, found `";
+            s += "`, found `";
             s += self.this_token_to_str();
-            s += ~"`";
+            s += "`";
             self.fatal(s);
         }
     }
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index d49a3d7fe42..eabe664d8ef 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -320,7 +320,7 @@ fn consume_block_comment(rdr: @mut StringReader)
         if is_eof(rdr) {
             rdr.fatal(~"unterminated block doc-comment");
         } else {
-            acc += ~"*/";
+            acc += "*/";
             bump(rdr);
             bump(rdr);
             // but comments with only "*"s between two "/"s are not
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e8b200439d6..1af0cfab273 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3584,7 +3584,7 @@ pub impl Parser {
         let prefix = prefix.dir_path();
         let mod_path_stack = &*self.mod_path_stack;
         let mod_path = Path(".").push_many(*mod_path_stack);
-        let default_path = *self.sess.interner.get(id) + ~".rs";
+        let default_path = *self.sess.interner.get(id) + ".rs";
         let file_path = match ::attr::first_attr_value_str_by_name(
             outer_attrs, "path") {
             Some(d) => {
@@ -4213,8 +4213,8 @@ pub impl Parser {
         // FAILURE TO PARSE ITEM
         if visibility != inherited {
             let mut s = ~"unmatched visibility `";
-            s += if visibility == public { ~"pub" } else { ~"priv" };
-            s += ~"`";
+            s += if visibility == public { "pub" } else { "priv" };
+            s += "`";
             self.span_fatal(*self.last_span, s);
         }
         return iovi_none;
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),