codegen_llvm_back: use to_owned instead of to_string with string literals

This commit is contained in:
ljedrz 2018-10-06 11:50:00 +02:00
parent 3dbb2cc864
commit 0195d9b95f
4 changed files with 5 additions and 5 deletions

View file

@ -172,7 +172,7 @@ impl<'a> ArchiveBuilder<'a> {
let name = file.file_name().unwrap().to_str().unwrap();
self.additions.push(Addition::File {
path: file.to_path_buf(),
name_in_archive: name.to_string(),
name_in_archive: name.to_owned(),
});
}

View file

@ -42,7 +42,7 @@ pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec<String> {
// Use DT_RUNPATH instead of DT_RPATH if available
if config.linker_is_gnu {
flags.push("-Wl,--enable-new-dtags".to_string());
flags.push("-Wl,--enable-new-dtags".to_owned());
}
flags
@ -169,7 +169,7 @@ fn get_install_prefix_rpath(config: &mut RPathConfig) -> String {
let path = (config.get_install_prefix_lib_path)();
let path = env::current_dir().unwrap().join(&path);
// FIXME (#9639): This needs to handle non-utf8 paths
path.to_str().expect("non-utf8 component in rpath").to_string()
path.to_str().expect("non-utf8 component in rpath").to_owned()
}
fn minimize_rpaths(rpaths: &[String]) -> Vec<String> {

View file

@ -455,7 +455,7 @@ impl<'a> Drop for DiagnosticHandlers<'a> {
unsafe extern "C" fn report_inline_asm<'a, 'b>(cgcx: &'a CodegenContext,
msg: &'b str,
cookie: c_uint) {
cgcx.diag_emitter.inline_asm_error(cookie as u32, msg.to_string());
cgcx.diag_emitter.inline_asm_error(cookie as u32, msg.to_owned());
}
unsafe extern "C" fn inline_asm_handler(diag: &SMDiagnostic,

View file

@ -860,7 +860,7 @@ impl<'a> Linker for EmLinker<'a> {
let res = encoder.emit_seq(symbols.len(), |encoder| {
for (i, sym) in symbols.iter().enumerate() {
encoder.emit_seq_elt(i, |encoder| {
encoder.emit_str(&("_".to_string() + sym))
encoder.emit_str(&("_".to_owned() + sym))
})?;
}
Ok(())