Skip to content

Commit dc97181

Browse files
Mark-Simulacrumsinkuu
authored andcommitted
Do not base path to append extension
We already have ownership of the base path, so no need to clone it (within Path::with_extension).
1 parent 8c6067c commit dc97181

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustc_session/config.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,6 @@ impl OutputFilenames {
491491
/// Like temp_path, but also supports things where there is no corresponding
492492
/// OutputType, like noopt-bitcode or lto-bitcode.
493493
pub fn temp_path_ext(&self, ext: &str, codegen_unit_name: Option<&str>) -> PathBuf {
494-
let base = self.out_directory.join(&self.filestem);
495-
496494
let mut extension = String::new();
497495

498496
if let Some(codegen_unit_name) = codegen_unit_name {
@@ -509,11 +507,13 @@ impl OutputFilenames {
509507
extension.push_str(ext);
510508
}
511509

512-
base.with_extension(extension)
510+
self.with_extension(&extension)
513511
}
514512

515513
pub fn with_extension(&self, extension: &str) -> PathBuf {
516-
self.out_directory.join(&self.filestem).with_extension(extension)
514+
let mut path = self.out_directory.join(&self.filestem);
515+
path.set_extension(extension);
516+
path
517517
}
518518
}
519519

0 commit comments

Comments
 (0)