Skip to content

Commit 8c6067c

Browse files
Mark-Simulacrumsinkuu
authored andcommitted
Store filestem in a pre-formatted form
1 parent d1bb7e1 commit 8c6067c

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/librustc_session/config.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,8 @@ impl Input {
447447
#[derive(Clone, Hash)]
448448
pub struct OutputFilenames {
449449
pub out_directory: PathBuf,
450-
out_filestem: String,
450+
filestem: String,
451451
pub single_output_file: Option<PathBuf>,
452-
extra: String,
453452
pub outputs: OutputTypes,
454453
}
455454

@@ -465,7 +464,12 @@ impl OutputFilenames {
465464
extra: String,
466465
outputs: OutputTypes,
467466
) -> Self {
468-
OutputFilenames { out_directory, out_filestem, single_output_file, extra, outputs }
467+
OutputFilenames {
468+
out_directory,
469+
single_output_file,
470+
outputs,
471+
filestem: format!("{}{}", out_filestem, extra),
472+
}
469473
}
470474

471475
pub fn path(&self, flavor: OutputType) -> PathBuf {
@@ -487,7 +491,7 @@ impl OutputFilenames {
487491
/// Like temp_path, but also supports things where there is no corresponding
488492
/// OutputType, like noopt-bitcode or lto-bitcode.
489493
pub fn temp_path_ext(&self, ext: &str, codegen_unit_name: Option<&str>) -> PathBuf {
490-
let base = self.out_directory.join(&self.filestem());
494+
let base = self.out_directory.join(&self.filestem);
491495

492496
let mut extension = String::new();
493497

@@ -505,16 +509,11 @@ impl OutputFilenames {
505509
extension.push_str(ext);
506510
}
507511

508-
let path = base.with_extension(&extension[..]);
509-
path
512+
base.with_extension(extension)
510513
}
511514

512515
pub fn with_extension(&self, extension: &str) -> PathBuf {
513-
self.out_directory.join(&self.filestem()).with_extension(extension)
514-
}
515-
516-
pub fn filestem(&self) -> String {
517-
format!("{}{}", self.out_filestem, self.extra)
516+
self.out_directory.join(&self.filestem).with_extension(extension)
518517
}
519518
}
520519

0 commit comments

Comments
 (0)