diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-16 10:45:16 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-22 14:42:01 -0700 |
| commit | 36195eb91f15975fed7555a3aa52807ecd5698a1 (patch) | |
| tree | d0e99310be4a24e76b8d6b13f05ec79c1f89b6ba /src/libsyntax/diagnostic.rs | |
| parent | e402e75f4eb79af09b9451f0f232f994b3e2c998 (diff) | |
| download | rust-36195eb91f15975fed7555a3aa52807ecd5698a1.tar.gz rust-36195eb91f15975fed7555a3aa52807ecd5698a1.zip | |
libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.
Diffstat (limited to 'src/libsyntax/diagnostic.rs')
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 3eb6f40ba53..aa8f397f747 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -143,13 +143,13 @@ impl Handler { let s; match self.err_count.get() { 0u => return, - 1u => s = "aborting due to previous error".to_owned(), + 1u => s = "aborting due to previous error".to_strbuf(), _ => { s = format!("aborting due to {} previous errors", - self.err_count.get()); + self.err_count.get()); } } - self.fatal(s); + self.fatal(s.as_slice()); } pub fn warn(&self, msg: &str) { self.emit.borrow_mut().emit(None, msg, Warning); @@ -267,9 +267,12 @@ fn print_diagnostic(dst: &mut EmitterWriter, try!(write!(&mut dst.dst, "{} ", topic)); } - try!(print_maybe_styled(dst, format!("{}: ", lvl.to_str()), + try!(print_maybe_styled(dst, + format!("{}: ", lvl.to_str()).as_slice(), term::attr::ForegroundColor(lvl.color()))); - try!(print_maybe_styled(dst, format!("{}\n", msg), term::attr::Bold)); + try!(print_maybe_styled(dst, + format!("{}\n", msg).as_slice(), + term::attr::Bold)); Ok(()) } @@ -495,7 +498,8 @@ fn print_macro_backtrace(w: &mut EmitterWriter, }; try!(print_diagnostic(w, ss.as_slice(), Note, format!("in expansion of {}{}{}", pre, - ei.callee.name, post))); + ei.callee.name, + post).as_slice())); let ss = cm.span_to_str(ei.call_site); try!(print_diagnostic(w, ss.as_slice(), Note, "expansion site")); try!(print_macro_backtrace(w, cm, ei.call_site)); |
