]> git.lizzy.rs Git - rust.git/commitdiff
libfmt_macros: Remove all uses of `~str` from `libfmt_macros`
authorPatrick Walton <pcwalton@mimiga.net>
Thu, 15 May 2014 04:01:21 +0000 (21:01 -0700)
committerPatrick Walton <pcwalton@mimiga.net>
Fri, 16 May 2014 18:41:27 +0000 (11:41 -0700)
src/libfmt_macros/lib.rs
src/libsyntax/ext/format.rs

index 2151e53548008afa05a619826dae6d7fb094278a..e12026340d8285b06e4fde2bfa32c2f313755f76 100644 (file)
@@ -203,7 +203,7 @@ pub struct Parser<'a> {
     cur: str::CharOffsets<'a>,
     depth: uint,
     /// Error messages accumulated during parsing
-    pub errors: Vec<~str>,
+    pub errors: Vec<StrBuf>,
 }
 
 impl<'a> Iterator<Piece<'a>> for Parser<'a> {
@@ -246,10 +246,10 @@ pub fn new<'a>(s: &'a str) -> Parser<'a> {
     }
 
     /// Notifies of an error. The message doesn't actually need to be of type
-    /// ~str, but I think it does when this eventually uses conditions so it
+    /// StrBuf, but I think it does when this eventually uses conditions so it
     /// might as well start using it now.
     fn err(&mut self, msg: &str) {
-        self.errors.push(msg.to_owned());
+        self.errors.push(msg.to_strbuf());
     }
 
     /// Optionally consumes the specified character. If the character is not at
index e92ce139d007036fa8d533c6727b6976709ee256..01124fdfa54df5d1941cae0e6e15c5a0fa40d426 100644 (file)
@@ -886,7 +886,9 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
     }
     match parser.errors.shift() {
         Some(error) => {
-            cx.ecx.span_err(efmt.span, "invalid format string: " + error);
+            cx.ecx.span_err(efmt.span,
+                            format_strbuf!("invalid format string: {}",
+                                           error).as_slice());
             return DummyResult::raw_expr(sp);
         }
         None => {}