about summary refs log tree commit diff
path: root/src/libsyntax
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
parent363e67273622285a65caa74bb63ecfa04df59055 (diff)
downloadrust-8f80323f09ef150efc5cf729100f99981afc96e1.tar.gz
rust-8f80323f09ef150efc5cf729100f99981afc96e1.zip
Remove unnecessary allocations flagged by lint
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostic.rs14
-rw-r--r--src/libsyntax/ext/asm.rs2
-rw-r--r--src/libsyntax/ext/fmt.rs12
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs10
-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
-rw-r--r--src/libsyntax/print/pp.rs4
-rw-r--r--src/libsyntax/print/pprust.rs2
12 files changed, 42 insertions, 42 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index 792b561f110..0057579c9b7 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -241,7 +241,7 @@ fn highlight_lines(cm: @codemap::CodeMap,
     // Print the offending lines
     for display_lines.each |line| {
         io::stderr().write_str(fmt!("%s:%u ", fm.name, *line + 1u));
-        let s = fm.get_line(*line as int) + ~"\n";
+        let s = fm.get_line(*line as int) + "\n";
         io::stderr().write_str(s);
     }
     if elided {
@@ -249,8 +249,8 @@ fn highlight_lines(cm: @codemap::CodeMap,
         let s = fmt!("%s:%u ", fm.name, last_line + 1u);
         let mut indent = str::len(s);
         let mut out = ~"";
-        while indent > 0u { out += ~" "; indent -= 1u; }
-        out += ~"...\n";
+        while indent > 0u { out += " "; indent -= 1u; }
+        out += "...\n";
         io::stderr().write_str(out);
     }
 
@@ -271,7 +271,7 @@ fn highlight_lines(cm: @codemap::CodeMap,
         // part of the 'filename:line ' part of the previous line.
         let skip = str::len(fm.name) + digits + 3u;
         for skip.times() {
-            s += ~" ";
+            s += " ";
         }
         let orig = fm.get_line(lines.lines[0] as int);
         for uint::range(0u,left-skip) |pos| {
@@ -281,14 +281,14 @@ fn highlight_lines(cm: @codemap::CodeMap,
                 _ => " "         // -squigly-line as well (instead of a
             };                   // space). This way the squigly-line will
         }                        // usually appear in the correct position.
-        s += ~"^";
+        s += "^";
         let hi = cm.lookup_char_pos(sp.hi);
         if hi.col != lo.col {
             // the ^ already takes up one space
             let num_squiglies = hi.col.to_uint()-lo.col.to_uint()-1u;
-            for num_squiglies.times() { s += ~"~"; }
+            for num_squiglies.times() { s += "~"; }
         }
-        io::stderr().write_str(s + ~"\n");
+        io::stderr().write_str(s + "\n");
     }
 }
 
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs
index 204eb9a9f8b..05ac87adcc5 100644
--- a/src/libsyntax/ext/asm.rs
+++ b/src/libsyntax/ext/asm.rs
@@ -114,7 +114,7 @@ pub fn expand_asm(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
                         p.eat(&token::COMMA);
                     }
 
-                    let clob = ~"~{" + *p.parse_str() + ~"}";
+                    let clob = ~"~{" + *p.parse_str() + "}";
                     clobs.push(clob);
                 }
 
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index 987f7fc319a..2efed5780b4 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -158,15 +158,15 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
               FlagSignAlways => {
                 if !is_signed_type(cnv) {
                     cx.span_fatal(sp,
-                                  ~"+ flag only valid in " +
-                                      ~"signed fmt! conversion");
+                                  "+ flag only valid in \
+                                   signed fmt! conversion");
                 }
               }
               FlagSpaceForSign => {
                 if !is_signed_type(cnv) {
                     cx.span_fatal(sp,
-                                  ~"space flag only valid in " +
-                                      ~"signed fmt! conversions");
+                                  "space flag only valid in \
+                                   signed fmt! conversions");
                 }
               }
               FlagLeftZeroPad => (),
@@ -284,8 +284,8 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
                 n += 1u;
                 if n >= nargs {
                     cx.span_fatal(sp,
-                                  ~"not enough arguments to fmt! " +
-                                  ~"for the given format string");
+                                  "not enough arguments to fmt! \
+                                   for the given format string");
                 }
 
                 log_conv(conv);
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 1a7b7e55ace..e55ecbc29bc 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -66,7 +66,7 @@ impl gen_send for message {
 
             let mut body = ~"{\n";
             body += fmt!("use super::%s;\n", name);
-            body += ~"let mut pipe = pipe;\n";
+            body += "let mut pipe = pipe;\n";
 
             if this.proto.is_bounded() {
                 let (sp, rp) = match (this.dir, next.dir) {
@@ -76,7 +76,7 @@ impl gen_send for message {
                   (recv, recv) => (~"c", ~"s")
                 };
 
-                body += ~"let mut b = pipe.reuse_buffer();\n";
+                body += "let mut b = pipe.reuse_buffer();\n";
                 body += fmt!("let %s = ::std::pipes::SendPacketBuffered(\
                               &mut (b.buffer.data.%s));\n",
                              sp, next.name);
@@ -103,7 +103,7 @@ impl gen_send for message {
             if !try {
                 body += fmt!("::std::pipes::send(pipe, message);\n");
                 // return the new channel
-                body += ~"c }";
+                body += "c }";
             }
             else {
                 body += fmt!("if ::std::pipes::send(pipe, message) {\n \
@@ -152,7 +152,7 @@ impl gen_send for message {
                 }
                 else {
                     ~"(" + str::connect(arg_names.map(|x| copy *x),
-                                        ", ") + ~")"
+                                        ", ") + ")"
                 };
 
                 let mut body = ~"{ ";
@@ -161,7 +161,7 @@ impl gen_send for message {
 
                 if !try {
                     body += fmt!("::std::pipes::send(pipe, message);\n");
-                    body += ~" }";
+                    body += " }";
                 } else {
                     body += fmt!("if ::std::pipes::send(pipe, message) \
                                         { \
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),
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index 4e2fd5592df..d3b5c751e69 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -120,12 +120,12 @@ pub fn buf_str(toks: ~[token], szs: ~[int], left: uint, right: uint,
     let mut s = ~"[";
     while i != right && L != 0u {
         L -= 1u;
-        if i != left { s += ~", "; }
+        if i != left { s += ", "; }
         s += fmt!("%d=%s", szs[i], tok_str(toks[i]));
         i += 1u;
         i %= n;
     }
-    s += ~"]";
+    s += "]";
     return s;
 }
 
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 9110becefbc..3ecd0e6ab80 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1996,7 +1996,7 @@ pub fn print_literal(s: @ps, lit: @ast::lit) {
     match lit.node {
       ast::lit_str(st) => print_string(s, *st),
       ast::lit_int(ch, ast::ty_char) => {
-        word(s.s, ~"'" + char::escape_default(ch as char) + ~"'");
+        word(s.s, ~"'" + char::escape_default(ch as char) + "'");
       }
       ast::lit_int(i, t) => {
         if i < 0_i64 {