Skip to content

Commit 6a2102c

Browse files
committed
Simplify output_path further
1 parent 1cd2da6 commit 6a2102c

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/lib.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -834,14 +834,6 @@ fn run_rustfix(
834834
}
835835
}
836836

837-
fn revised(revision: &str, extension: &str) -> String {
838-
if revision.is_empty() {
839-
extension.to_string()
840-
} else {
841-
format!("{revision}.{extension}")
842-
}
843-
}
844-
845837
fn check_test_result(
846838
command: Command,
847839
mode: Mode,
@@ -1055,7 +1047,7 @@ fn check_output(
10551047
config: &TestConfig,
10561048
) -> PathBuf {
10571049
let output = normalize(output, config.comments, config.revision, kind);
1058-
let path = output_path(config, revised(config.revision, kind));
1050+
let path = output_path(config, kind);
10591051
match &config.config.output_conflict_handling {
10601052
OutputConflictHandling::Error => {
10611053
let expected_output = std::fs::read(&path).unwrap_or_default();
@@ -1080,13 +1072,14 @@ fn check_output(
10801072
path
10811073
}
10821074

1083-
fn output_path(config: &TestConfig<'_>, kind: String) -> PathBuf {
1075+
fn output_path(config: &TestConfig<'_>, kind: &str) -> PathBuf {
1076+
let ext = config.extension(kind);
10841077
if config.comments().any(|r| r.stderr_per_bitwidth) {
10851078
return config
10861079
.path
1087-
.with_extension(format!("{}bit.{kind}", config.config.get_pointer_width()));
1080+
.with_extension(format!("{}bit.{ext}", config.config.get_pointer_width()));
10881081
}
1089-
config.path.with_extension(kind)
1082+
config.path.with_extension(ext)
10901083
}
10911084

10921085
fn normalize(text: &[u8], comments: &Comments, revision: &str, kind: &'static str) -> Vec<u8> {

0 commit comments

Comments
 (0)