about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2020-01-21 09:57:50 -0500
committerShotaro Yamada <sinkuu@sinkuu.xyz>2020-01-22 08:10:41 +0900
commitdc97181a0966cd1686a70ce06849a19c196f72eb (patch)
tree4960b47e2ea580f6286faed0503e43b52070b165
parent8c6067c24e181aa388619ca0f39100e5c9a1f509 (diff)
downloadrust-dc97181a0966cd1686a70ce06849a19c196f72eb.tar.gz
rust-dc97181a0966cd1686a70ce06849a19c196f72eb.zip
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).
-rw-r--r--src/librustc_session/config.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs
index 81e8e474458..c7fcd04c45a 100644
--- a/src/librustc_session/config.rs
+++ b/src/librustc_session/config.rs
@@ -491,8 +491,6 @@ impl OutputFilenames {
     /// Like temp_path, but also supports things where there is no corresponding
     /// OutputType, like noopt-bitcode or lto-bitcode.
     pub fn temp_path_ext(&self, ext: &str, codegen_unit_name: Option<&str>) -> PathBuf {
-        let base = self.out_directory.join(&self.filestem);
-
         let mut extension = String::new();
 
         if let Some(codegen_unit_name) = codegen_unit_name {
@@ -509,11 +507,13 @@ impl OutputFilenames {
             extension.push_str(ext);
         }
 
-        base.with_extension(extension)
+        self.with_extension(&extension)
     }
 
     pub fn with_extension(&self, extension: &str) -> PathBuf {
-        self.out_directory.join(&self.filestem).with_extension(extension)
+        let mut path = self.out_directory.join(&self.filestem);
+        path.set_extension(extension);
+        path
     }
 }