From 67e39a8e7686bd33b9a8fbfc926f619029a33ac0 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 14 May 2014 21:01:21 -0700 Subject: [PATCH] libfmt_macros: Remove all uses of `~str` from `libfmt_macros` --- src/libfmt_macros/lib.rs | 6 +++--- src/libsyntax/ext/format.rs | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) 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 => {} -- 2.44.0