From: Patrick Walton Date: Thu, 15 May 2014 04:01:21 +0000 (-0700) Subject: libfmt_macros: Remove all uses of `~str` from `libfmt_macros` X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=67e39a8e7686bd33b9a8fbfc926f619029a33ac0;p=rust.git libfmt_macros: Remove all uses of `~str` from `libfmt_macros` --- diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 2151e535480..e12026340d8 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -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, } impl<'a> Iterator> 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 diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index e92ce139d00..01124fdfa54 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -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 => {}