Skip to content

Commit 0195d9b

Browse files
committed
codegen_llvm_back: use to_owned instead of to_string with string literals
1 parent 3dbb2cc commit 0195d9b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/librustc_codegen_llvm/back/archive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl<'a> ArchiveBuilder<'a> {
172172
let name = file.file_name().unwrap().to_str().unwrap();
173173
self.additions.push(Addition::File {
174174
path: file.to_path_buf(),
175-
name_in_archive: name.to_string(),
175+
name_in_archive: name.to_owned(),
176176
});
177177
}
178178

src/librustc_codegen_llvm/back/rpath.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec<String> {
4242

4343
// Use DT_RUNPATH instead of DT_RPATH if available
4444
if config.linker_is_gnu {
45-
flags.push("-Wl,--enable-new-dtags".to_string());
45+
flags.push("-Wl,--enable-new-dtags".to_owned());
4646
}
4747

4848
flags
@@ -169,7 +169,7 @@ fn get_install_prefix_rpath(config: &mut RPathConfig) -> String {
169169
let path = (config.get_install_prefix_lib_path)();
170170
let path = env::current_dir().unwrap().join(&path);
171171
// FIXME (#9639): This needs to handle non-utf8 paths
172-
path.to_str().expect("non-utf8 component in rpath").to_string()
172+
path.to_str().expect("non-utf8 component in rpath").to_owned()
173173
}
174174

175175
fn minimize_rpaths(rpaths: &[String]) -> Vec<String> {

src/librustc_codegen_llvm/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ impl<'a> Drop for DiagnosticHandlers<'a> {
455455
unsafe extern "C" fn report_inline_asm<'a, 'b>(cgcx: &'a CodegenContext,
456456
msg: &'b str,
457457
cookie: c_uint) {
458-
cgcx.diag_emitter.inline_asm_error(cookie as u32, msg.to_string());
458+
cgcx.diag_emitter.inline_asm_error(cookie as u32, msg.to_owned());
459459
}
460460

461461
unsafe extern "C" fn inline_asm_handler(diag: &SMDiagnostic,

src/librustc_codegen_utils/linker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ impl<'a> Linker for EmLinker<'a> {
860860
let res = encoder.emit_seq(symbols.len(), |encoder| {
861861
for (i, sym) in symbols.iter().enumerate() {
862862
encoder.emit_seq_elt(i, |encoder| {
863-
encoder.emit_str(&("_".to_string() + sym))
863+
encoder.emit_str(&("_".to_owned() + sym))
864864
})?;
865865
}
866866
Ok(())

0 commit comments

Comments
 (0)