Skip to content

Commit 2c482d8

Browse files
committed
rustc/driver: use Cow<str> where applicable
1 parent 9a1de08 commit 2c482d8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/librustc_driver/lib.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ use rustc_codegen_utils::codegen_backend::CodegenBackend;
9090
use serialize::json::ToJson;
9191

9292
use std::any::Any;
93+
use std::borrow::Cow;
9394
use std::cmp::max;
9495
use std::default::Default;
9596
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
@@ -1678,25 +1679,25 @@ pub fn monitor<F: FnOnce() + Send + 'static>(f: F) -> Result<(), CompilationFail
16781679
errors::Level::Bug);
16791680
}
16801681

1681-
let mut xs = vec![
1682-
"the compiler unexpectedly panicked. this is a bug.".to_string(),
1683-
format!("we would appreciate a bug report: {}", BUG_REPORT_URL),
1682+
let mut xs: Vec<Cow<'static, str>> = vec![
1683+
"the compiler unexpectedly panicked. this is a bug.".into(),
1684+
format!("we would appreciate a bug report: {}", BUG_REPORT_URL).into(),
16841685
format!("rustc {} running on {}",
16851686
option_env!("CFG_VERSION").unwrap_or("unknown_version"),
1686-
config::host_triple()),
1687+
config::host_triple()).into(),
16871688
];
16881689

16891690
if let Some((flags, excluded_cargo_defaults)) = extra_compiler_flags() {
1690-
xs.push(format!("compiler flags: {}", flags.join(" ")));
1691+
xs.push(format!("compiler flags: {}", flags.join(" ")).into());
16911692

16921693
if excluded_cargo_defaults {
1693-
xs.push("some of the compiler flags provided by cargo are hidden".to_string());
1694+
xs.push("some of the compiler flags provided by cargo are hidden".into());
16941695
}
16951696
}
16961697

16971698
for note in &xs {
16981699
handler.emit(&MultiSpan::new(),
1699-
&note,
1700+
note,
17001701
errors::Level::Note);
17011702
}
17021703

0 commit comments

Comments
 (0)