Skip to content

Commit cf24a9f

Browse files
authored
Rollup merge of #115425 - thechampagne:master, r=oli-obk
remove unnecessary heap allocation
2 parents 888dc2e + 9adc6a4 commit cf24a9f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_codegen_llvm/src/back/archive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ impl<'a> LlvmArchiveBuilder<'a> {
367367
match addition {
368368
Addition::File { path, name_in_archive } => {
369369
let path = CString::new(path.to_str().unwrap())?;
370-
let name = CString::new(name_in_archive.clone())?;
370+
let name = CString::new(name_in_archive.as_bytes())?;
371371
members.push(llvm::LLVMRustArchiveMemberNew(
372372
path.as_ptr(),
373373
name.as_ptr(),

compiler/rustc_codegen_llvm/src/back/lto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ fn thin_lto(
441441

442442
for (i, (name, buffer)) in modules.into_iter().enumerate() {
443443
info!("local module: {} - {}", i, name);
444-
let cname = CString::new(name.clone()).unwrap();
444+
let cname = CString::new(name.as_bytes()).unwrap();
445445
thin_modules.push(llvm::ThinLTOModule {
446446
identifier: cname.as_ptr(),
447447
data: buffer.data().as_ptr(),

0 commit comments

Comments
 (0)