about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorRicho Healey <richo@psych0tik.net>2014-05-25 03:17:19 -0700
committerRicho Healey <richo@psych0tik.net>2014-05-27 12:59:31 -0700
commit1f1b2e42d76ba1cd884adc49922636a6c2ac1b2f (patch)
tree2a56d5ceda84c1a58796fe0fc4e7cea38a9336f6 /src/libsyntax/parse
parent4348e23b269739657d934b532ad061bfd6d92309 (diff)
downloadrust-1f1b2e42d76ba1cd884adc49922636a6c2ac1b2f.tar.gz
rust-1f1b2e42d76ba1cd884adc49922636a6c2ac1b2f.zip
std: Rename strbuf operations to string
[breaking-change]
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/comments.rs38
-rw-r--r--src/libsyntax/parse/lexer.rs34
-rw-r--r--src/libsyntax/parse/mod.rs32
-rw-r--r--src/libsyntax/parse/parser.rs6
-rw-r--r--src/libsyntax/parse/token.rs98
5 files changed, 104 insertions, 104 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 907e89622d0..cc08cb429f5 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -111,7 +111,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String {
 
         if can_trim {
             lines.iter().map(|line| {
-                line.as_slice().slice(i + 1, line.len()).to_strbuf()
+                line.as_slice().slice(i + 1, line.len()).to_string()
             }).collect()
         } else {
             lines
@@ -122,20 +122,20 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String {
     static ONLINERS: &'static [&'static str] = &["///!", "///", "//!", "//"];
     for prefix in ONLINERS.iter() {
         if comment.starts_with(*prefix) {
-            return comment.slice_from(prefix.len()).to_strbuf();
+            return comment.slice_from(prefix.len()).to_string();
         }
     }
 
     if comment.starts_with("/*") {
         let lines = comment.slice(3u, comment.len() - 2u)
             .lines_any()
-            .map(|s| s.to_strbuf())
+            .map(|s| s.to_string())
             .collect::<Vec<String> >();
 
         let lines = vertical_trim(lines);
         let lines = horizontal_trim(lines);
 
-        return lines.connect("\n").to_strbuf();
+        return lines.connect("\n").to_string();
     }
 
     fail!("not a doc-comment: {}", comment);
@@ -247,9 +247,9 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String> ,
     let s1 = match all_whitespace(s.as_slice(), col) {
         Some(col) => {
             if col < len {
-                s.as_slice().slice(col, len).to_strbuf()
+                s.as_slice().slice(col, len).to_string()
             } else {
-                "".to_strbuf()
+                "".to_string()
             }
         }
         None => s,
@@ -368,7 +368,7 @@ pub fn gather_comments_and_literals(span_diagnostic:
                                     srdr: &mut io::Reader)
                                  -> (Vec<Comment>, Vec<Literal>) {
     let src = srdr.read_to_end().unwrap();
-    let src = str::from_utf8(src.as_slice()).unwrap().to_strbuf();
+    let src = str::from_utf8(src.as_slice()).unwrap().to_string();
     let cm = CodeMap::new();
     let filemap = cm.new_filemap(path, src);
     let mut rdr = lexer::new_low_level_string_reader(span_diagnostic, filemap);
@@ -399,7 +399,7 @@ pub fn gather_comments_and_literals(span_diagnostic:
         if token::is_lit(&tok) {
             with_str_from(&rdr, bstart, |s| {
                 debug!("tok lit: {}", s);
-                literals.push(Literal {lit: s.to_strbuf(), pos: sp.lo});
+                literals.push(Literal {lit: s.to_string(), pos: sp.lo});
             })
         } else {
             debug!("tok: {}", token::to_str(&tok));
@@ -417,41 +417,41 @@ mod test {
     #[test] fn test_block_doc_comment_1() {
         let comment = "/**\n * Test \n **  Test\n *   Test\n*/";
         let stripped = strip_doc_comment_decoration(comment);
-        assert_eq!(stripped, " Test \n*  Test\n   Test".to_strbuf());
+        assert_eq!(stripped, " Test \n*  Test\n   Test".to_string());
     }
 
     #[test] fn test_block_doc_comment_2() {
         let comment = "/**\n * Test\n *  Test\n*/";
         let stripped = strip_doc_comment_decoration(comment);
-        assert_eq!(stripped, " Test\n  Test".to_strbuf());
+        assert_eq!(stripped, " Test\n  Test".to_string());
     }
 
     #[test] fn test_block_doc_comment_3() {
         let comment = "/**\n let a: *int;\n *a = 5;\n*/";
         let stripped = strip_doc_comment_decoration(comment);
-        assert_eq!(stripped, " let a: *int;\n *a = 5;".to_strbuf());
+        assert_eq!(stripped, " let a: *int;\n *a = 5;".to_string());
     }
 
     #[test] fn test_block_doc_comment_4() {
         let comment = "/*******************\n test\n *********************/";
         let stripped = strip_doc_comment_decoration(comment);
-        assert_eq!(stripped, " test".to_strbuf());
+        assert_eq!(stripped, " test".to_string());
     }
 
     #[test] fn test_line_doc_comment() {
         let stripped = strip_doc_comment_decoration("/// test");
-        assert_eq!(stripped, " test".to_strbuf());
+        assert_eq!(stripped, " test".to_string());
         let stripped = strip_doc_comment_decoration("///! test");
-        assert_eq!(stripped, " test".to_strbuf());
+        assert_eq!(stripped, " test".to_string());
         let stripped = strip_doc_comment_decoration("// test");
-        assert_eq!(stripped, " test".to_strbuf());
+        assert_eq!(stripped, " test".to_string());
         let stripped = strip_doc_comment_decoration("// test");
-        assert_eq!(stripped, " test".to_strbuf());
+        assert_eq!(stripped, " test".to_string());
         let stripped = strip_doc_comment_decoration("///test");
-        assert_eq!(stripped, "test".to_strbuf());
+        assert_eq!(stripped, "test".to_string());
         let stripped = strip_doc_comment_decoration("///!test");
-        assert_eq!(stripped, "test".to_strbuf());
+        assert_eq!(stripped, "test".to_string());
         let stripped = strip_doc_comment_decoration("//test");
-        assert_eq!(stripped, "test".to_strbuf());
+        assert_eq!(stripped, "test".to_string());
     }
 }
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index e045116c9e2..fb67a76b85b 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -156,14 +156,14 @@ fn err_span(rdr: &mut StringReader, from_pos: BytePos, to_pos: BytePos, m: &str)
 fn fatal_span_char(rdr: &mut StringReader,
                    from_pos: BytePos, to_pos: BytePos,
                    m: &str, c: char) -> ! {
-    let mut m = m.to_strbuf();
+    let mut m = m.to_string();
     m.push_str(": ");
     char::escape_default(c, |c| m.push_char(c));
     fatal_span(rdr, from_pos, to_pos, m.as_slice());
 }
 
 fn err_span_char(rdr: &mut StringReader, from_pos: BytePos, to_pos: BytePos, m: &str, c: char) {
-    let mut m = m.to_strbuf();
+    let mut m = m.to_string();
     m.push_str(": ");
     char::escape_default(c, |c| m.push_char(c));
     err_span(rdr, from_pos, to_pos, m.as_slice());
@@ -172,7 +172,7 @@ fn err_span_char(rdr: &mut StringReader, from_pos: BytePos, to_pos: BytePos, m:
 // report a lexical error spanning [`from_pos`, `to_pos`), appending the
 // offending string to the error message
 fn fatal_span_verbose(rdr: &mut StringReader, from_pos: BytePos, to_pos: BytePos, m: &str) -> ! {
-    let mut m = m.to_strbuf();
+    let mut m = m.to_string();
     m.push_str(": ");
     let from = byte_offset(rdr, from_pos).to_uint();
     let to = byte_offset(rdr, to_pos).to_uint();
@@ -528,7 +528,7 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token {
         }
         if num_str.len() == 0u {
             err_span(rdr, start_bpos, rdr.last_pos, "no valid digits found for number");
-            num_str = "1".to_strbuf();
+            num_str = "1".to_string();
         }
         let parsed = match from_str_radix::<u64>(num_str.as_slice(),
                                                  base as uint) {
@@ -594,7 +594,7 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token {
     } else {
         if num_str.len() == 0u {
             err_span(rdr, start_bpos, rdr.last_pos, "no valid digits found for number");
-            num_str = "1".to_strbuf();
+            num_str = "1".to_string();
         }
         let parsed = match from_str_radix::<u64>(num_str.as_slice(),
                                                  base as uint) {
@@ -1003,7 +1003,7 @@ mod test {
     // open a string reader for the given string
     fn setup<'a>(span_handler: &'a diagnostic::SpanHandler,
                  teststr: String) -> StringReader<'a> {
-        let fm = span_handler.cm.new_filemap("zebra.rs".to_strbuf(), teststr);
+        let fm = span_handler.cm.new_filemap("zebra.rs".to_string(), teststr);
         new_string_reader(span_handler, fm)
     }
 
@@ -1011,7 +1011,7 @@ mod test {
         let span_handler = mk_sh();
         let mut string_reader = setup(&span_handler,
             "/* my source file */ \
-             fn main() { println!(\"zebra\"); }\n".to_strbuf());
+             fn main() { println!(\"zebra\"); }\n".to_string());
         let id = str_to_ident("fn");
         let tok1 = string_reader.next_token();
         let tok2 = TokenAndSpan{
@@ -1044,55 +1044,55 @@ mod test {
     }
 
     #[test] fn doublecolonparsing () {
-        check_tokenization(setup(&mk_sh(), "a b".to_strbuf()),
+        check_tokenization(setup(&mk_sh(), "a b".to_string()),
                            vec!(mk_ident("a",false),
                              mk_ident("b",false)));
     }
 
     #[test] fn dcparsing_2 () {
-        check_tokenization(setup(&mk_sh(), "a::b".to_strbuf()),
+        check_tokenization(setup(&mk_sh(), "a::b".to_string()),
                            vec!(mk_ident("a",true),
                              token::MOD_SEP,
                              mk_ident("b",false)));
     }
 
     #[test] fn dcparsing_3 () {
-        check_tokenization(setup(&mk_sh(), "a ::b".to_strbuf()),
+        check_tokenization(setup(&mk_sh(), "a ::b".to_string()),
                            vec!(mk_ident("a",false),
                              token::MOD_SEP,
                              mk_ident("b",false)));
     }
 
     #[test] fn dcparsing_4 () {
-        check_tokenization(setup(&mk_sh(), "a:: b".to_strbuf()),
+        check_tokenization(setup(&mk_sh(), "a:: b".to_string()),
                            vec!(mk_ident("a",true),
                              token::MOD_SEP,
                              mk_ident("b",false)));
     }
 
     #[test] fn character_a() {
-        assert_eq!(setup(&mk_sh(), "'a'".to_strbuf()).next_token().tok,
+        assert_eq!(setup(&mk_sh(), "'a'".to_string()).next_token().tok,
                    token::LIT_CHAR('a'));
     }
 
     #[test] fn character_space() {
-        assert_eq!(setup(&mk_sh(), "' '".to_strbuf()).next_token().tok,
+        assert_eq!(setup(&mk_sh(), "' '".to_string()).next_token().tok,
                    token::LIT_CHAR(' '));
     }
 
     #[test] fn character_escaped() {
-        assert_eq!(setup(&mk_sh(), "'\\n'".to_strbuf()).next_token().tok,
+        assert_eq!(setup(&mk_sh(), "'\\n'".to_string()).next_token().tok,
                    token::LIT_CHAR('\n'));
     }
 
     #[test] fn lifetime_name() {
-        assert_eq!(setup(&mk_sh(), "'abc".to_strbuf()).next_token().tok,
+        assert_eq!(setup(&mk_sh(), "'abc".to_string()).next_token().tok,
                    token::LIFETIME(token::str_to_ident("abc")));
     }
 
     #[test] fn raw_string() {
         assert_eq!(setup(&mk_sh(),
-                         "r###\"\"#a\\b\x00c\"\"###".to_strbuf()).next_token()
+                         "r###\"\"#a\\b\x00c\"\"###".to_string()).next_token()
                                                                  .tok,
                    token::LIT_STR_RAW(token::str_to_ident("\"#a\\b\x00c\""), 3));
     }
@@ -1105,7 +1105,7 @@ mod test {
 
     #[test] fn nested_block_comments() {
         assert_eq!(setup(&mk_sh(),
-                         "/* /* */ */'a'".to_strbuf()).next_token().tok,
+                         "/* /* */ */'a'".to_string()).next_token().tok,
                    token::LIT_CHAR('a'));
     }
 
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index c4947b528f1..ce89a7dec39 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -232,8 +232,8 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
     };
     match str::from_utf8(bytes.as_slice()) {
         Some(s) => {
-            return string_to_filemap(sess, s.to_strbuf(),
-                                     path.as_str().unwrap().to_strbuf())
+            return string_to_filemap(sess, s.to_string(),
+                                     path.as_str().unwrap().to_string())
         }
         None => {
             err(format!("{} is not UTF-8 encoded", path.display()).as_slice())
@@ -297,7 +297,7 @@ mod test {
         let mut writer = MemWriter::new();
         let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer);
         let _ = val.encode(&mut encoder);
-        str::from_utf8(writer.unwrap().as_slice()).unwrap().to_strbuf()
+        str::from_utf8(writer.unwrap().as_slice()).unwrap().to_string()
     }
 
     // produce a codemap::span
@@ -306,7 +306,7 @@ mod test {
     }
 
     #[test] fn path_exprs_1() {
-        assert!(string_to_expr("a".to_strbuf()) ==
+        assert!(string_to_expr("a".to_string()) ==
                    @ast::Expr{
                     id: ast::DUMMY_NODE_ID,
                     node: ast::ExprPath(ast::Path {
@@ -325,7 +325,7 @@ mod test {
     }
 
     #[test] fn path_exprs_2 () {
-        assert!(string_to_expr("::a::b".to_strbuf()) ==
+        assert!(string_to_expr("::a::b".to_string()) ==
                    @ast::Expr {
                     id: ast::DUMMY_NODE_ID,
                     node: ast::ExprPath(ast::Path {
@@ -350,12 +350,12 @@ mod test {
 
     #[should_fail]
     #[test] fn bad_path_expr_1() {
-        string_to_expr("::abc::def::return".to_strbuf());
+        string_to_expr("::abc::def::return".to_string());
     }
 
     // check the token-tree-ization of macros
     #[test] fn string_to_tts_macro () {
-        let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_strbuf());
+        let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_string());
         let tts: &[ast::TokenTree] = tts.as_slice();
         match tts {
             [ast::TTTok(_,_),
@@ -408,7 +408,7 @@ mod test {
     }
 
     #[test] fn string_to_tts_1 () {
-        let tts = string_to_tts("fn a (b : int) { b; }".to_strbuf());
+        let tts = string_to_tts("fn a (b : int) { b; }".to_string());
         assert_eq!(to_json_str(&tts),
         "[\
     {\
@@ -532,12 +532,12 @@ mod test {
             ]\
         ]\
     }\
-]".to_strbuf()
+]".to_string()
         );
     }
 
     #[test] fn ret_expr() {
-        assert!(string_to_expr("return d".to_strbuf()) ==
+        assert!(string_to_expr("return d".to_string()) ==
                    @ast::Expr{
                     id: ast::DUMMY_NODE_ID,
                     node:ast::ExprRet(Some(@ast::Expr{
@@ -560,7 +560,7 @@ mod test {
     }
 
     #[test] fn parse_stmt_1 () {
-        assert!(string_to_stmt("b;".to_strbuf()) ==
+        assert!(string_to_stmt("b;".to_string()) ==
                    @Spanned{
                        node: ast::StmtExpr(@ast::Expr {
                            id: ast::DUMMY_NODE_ID,
@@ -587,7 +587,7 @@ mod test {
 
     #[test] fn parse_ident_pat () {
         let sess = new_parse_sess();
-        let mut parser = string_to_parser(&sess, "b".to_strbuf());
+        let mut parser = string_to_parser(&sess, "b".to_string());
         assert!(parser.parse_pat() ==
                    @ast::Pat{id: ast::DUMMY_NODE_ID,
                              node: ast::PatIdent(
@@ -611,7 +611,7 @@ mod test {
     // check the contents of the tt manually:
     #[test] fn parse_fundecl () {
         // this test depends on the intern order of "fn" and "int"
-        assert!(string_to_item("fn a (b : int) { b; }".to_strbuf()) ==
+        assert!(string_to_item("fn a (b : int) { b; }".to_string()) ==
                   Some(
                       @ast::Item{ident:str_to_ident("a"),
                             attrs:Vec::new(),
@@ -703,8 +703,8 @@ mod test {
 
     #[test] fn parse_exprs () {
         // just make sure that they parse....
-        string_to_expr("3 + 4".to_strbuf());
-        string_to_expr("a::z.froob(b,@(987+3))".to_strbuf());
+        string_to_expr("3 + 4".to_string());
+        string_to_expr("a::z.froob(b,@(987+3))".to_string());
     }
 
     #[test] fn attrs_fix_bug () {
@@ -719,7 +719,7 @@ mod test {
     fn wb() -> c_int { O_WRONLY as c_int }
 
     let mut fflags: c_int = wb();
-}".to_strbuf());
+}".to_string());
     }
 
 }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index b5ddd6cd20f..a8736b5b2c0 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -407,7 +407,7 @@ impl<'a> Parser<'a> {
             let mut i = tokens.iter();
             // This might be a sign we need a connect method on Iterator.
             let b = i.next()
-                     .map_or("".to_strbuf(), |t| Parser::token_to_str(t));
+                     .map_or("".to_string(), |t| Parser::token_to_str(t));
             i.fold(b, |b,a| {
                 let mut b = b;
                 b.push_str("`, `");
@@ -4171,7 +4171,7 @@ impl<'a> Parser<'a> {
                     self.span_err(id_sp,
                                   "cannot declare a new module at this location");
                     let this_module = match self.mod_path_stack.last() {
-                        Some(name) => name.get().to_strbuf(),
+                        Some(name) => name.get().to_string(),
                         None => self.root_module_name.get_ref().clone(),
                     };
                     self.span_note(id_sp,
@@ -4212,7 +4212,7 @@ impl<'a> Parser<'a> {
         };
 
         self.eval_src_mod_from_path(file_path, owns_directory,
-                                    mod_string.get().to_strbuf(), id_sp)
+                                    mod_string.get().to_string(), id_sp)
     }
 
     fn eval_src_mod_from_path(&mut self,
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index e3788801293..2c090d053a3 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -138,32 +138,32 @@ impl fmt::Show for Nonterminal {
 
 pub fn binop_to_str(o: BinOp) -> String {
     match o {
-      PLUS => "+".to_strbuf(),
-      MINUS => "-".to_strbuf(),
-      STAR => "*".to_strbuf(),
-      SLASH => "/".to_strbuf(),
-      PERCENT => "%".to_strbuf(),
-      CARET => "^".to_strbuf(),
-      AND => "&".to_strbuf(),
-      OR => "|".to_strbuf(),
-      SHL => "<<".to_strbuf(),
-      SHR => ">>".to_strbuf()
+      PLUS => "+".to_string(),
+      MINUS => "-".to_string(),
+      STAR => "*".to_string(),
+      SLASH => "/".to_string(),
+      PERCENT => "%".to_string(),
+      CARET => "^".to_string(),
+      AND => "&".to_string(),
+      OR => "|".to_string(),
+      SHL => "<<".to_string(),
+      SHR => ">>".to_string()
     }
 }
 
 pub fn to_str(t: &Token) -> String {
     match *t {
-      EQ => "=".to_strbuf(),
-      LT => "<".to_strbuf(),
-      LE => "<=".to_strbuf(),
-      EQEQ => "==".to_strbuf(),
-      NE => "!=".to_strbuf(),
-      GE => ">=".to_strbuf(),
-      GT => ">".to_strbuf(),
-      NOT => "!".to_strbuf(),
-      TILDE => "~".to_strbuf(),
-      OROR => "||".to_strbuf(),
-      ANDAND => "&&".to_strbuf(),
+      EQ => "=".to_string(),
+      LT => "<".to_string(),
+      LE => "<=".to_string(),
+      EQEQ => "==".to_string(),
+      NE => "!=".to_string(),
+      GE => ">=".to_string(),
+      GT => ">".to_string(),
+      NOT => "!".to_string(),
+      TILDE => "~".to_string(),
+      OROR => "||".to_string(),
+      ANDAND => "&&".to_string(),
       BINOP(op) => binop_to_str(op),
       BINOPEQ(op) => {
           let mut s = binop_to_str(op);
@@ -172,25 +172,25 @@ pub fn to_str(t: &Token) -> String {
       }
 
       /* Structural symbols */
-      AT => "@".to_strbuf(),
-      DOT => ".".to_strbuf(),
-      DOTDOT => "..".to_strbuf(),
-      DOTDOTDOT => "...".to_strbuf(),
-      COMMA => ",".to_strbuf(),
-      SEMI => ";".to_strbuf(),
-      COLON => ":".to_strbuf(),
-      MOD_SEP => "::".to_strbuf(),
-      RARROW => "->".to_strbuf(),
-      LARROW => "<-".to_strbuf(),
-      FAT_ARROW => "=>".to_strbuf(),
-      LPAREN => "(".to_strbuf(),
-      RPAREN => ")".to_strbuf(),
-      LBRACKET => "[".to_strbuf(),
-      RBRACKET => "]".to_strbuf(),
-      LBRACE => "{".to_strbuf(),
-      RBRACE => "}".to_strbuf(),
-      POUND => "#".to_strbuf(),
-      DOLLAR => "$".to_strbuf(),
+      AT => "@".to_string(),
+      DOT => ".".to_string(),
+      DOTDOT => "..".to_string(),
+      DOTDOTDOT => "...".to_string(),
+      COMMA => ",".to_string(),
+      SEMI => ";".to_string(),
+      COLON => ":".to_string(),
+      MOD_SEP => "::".to_string(),
+      RARROW => "->".to_string(),
+      LARROW => "<-".to_string(),
+      FAT_ARROW => "=>".to_string(),
+      LPAREN => "(".to_string(),
+      RPAREN => ")".to_string(),
+      LBRACKET => "[".to_string(),
+      RBRACKET => "]".to_string(),
+      LBRACE => "{".to_string(),
+      RBRACE => "}".to_string(),
+      POUND => "#".to_string(),
+      DOLLAR => "$".to_string(),
 
       /* Literals */
       LIT_CHAR(c) => {
@@ -205,7 +205,7 @@ pub fn to_str(t: &Token) -> String {
                                                ast_util::ForceSuffix),
       LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u),
                                                  ast_util::ForceSuffix),
-      LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_strbuf() }
+      LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_string() }
       LIT_FLOAT(s, t) => {
         let mut body = String::from_str(get_ident(s).get());
         if body.as_slice().ends_with(".") {
@@ -222,29 +222,29 @@ pub fn to_str(t: &Token) -> String {
         body
       }
       LIT_STR(s) => {
-          (format!("\"{}\"", get_ident(s).get().escape_default())).to_strbuf()
+          (format!("\"{}\"", get_ident(s).get().escape_default())).to_string()
       }
       LIT_STR_RAW(s, n) => {
           (format!("r{delim}\"{string}\"{delim}",
-                  delim="#".repeat(n), string=get_ident(s))).to_strbuf()
+                  delim="#".repeat(n), string=get_ident(s))).to_string()
       }
 
       /* Name components */
-      IDENT(s, _) => get_ident(s).get().to_strbuf(),
+      IDENT(s, _) => get_ident(s).get().to_string(),
       LIFETIME(s) => {
-          (format!("'{}", get_ident(s))).to_strbuf()
+          (format!("'{}", get_ident(s))).to_string()
       }
-      UNDERSCORE => "_".to_strbuf(),
+      UNDERSCORE => "_".to_string(),
 
       /* Other */
-      DOC_COMMENT(s) => get_ident(s).get().to_strbuf(),
-      EOF => "<eof>".to_strbuf(),
+      DOC_COMMENT(s) => get_ident(s).get().to_string(),
+      EOF => "<eof>".to_string(),
       INTERPOLATED(ref nt) => {
         match nt {
             &NtExpr(e) => ::print::pprust::expr_to_str(e),
             &NtMeta(e) => ::print::pprust::meta_item_to_str(e),
             _ => {
-                let mut s = "an interpolated ".to_strbuf();
+                let mut s = "an interpolated ".to_string();
                 match *nt {
                     NtItem(..) => s.push_str("item"),
                     NtBlock(..) => s.push_str("block"),