Skip to content

Commit a8dd6be

Browse files
committed
Pass TestConfig to output_path
1 parent d3b893b commit a8dd6be

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

src/lib.rs

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ fn build_aux_files(
586586
build_manager: &BuildManager<'_>,
587587
) -> Result<Vec<OsString>, Errored> {
588588
let mut extra_args = vec![];
589-
for rev in config.all() {
589+
for rev in config.comments() {
590590
for aux in &rev.aux_builds {
591591
let line = aux.line();
592592
let aux = &**aux;
@@ -1056,13 +1056,7 @@ fn check_output(
10561056
) -> PathBuf {
10571057
let target = config.config.target.as_ref().unwrap();
10581058
let output = normalize(output, config.comments, config.revision, kind);
1059-
let path = output_path(
1060-
config.path,
1061-
config.comments,
1062-
revised(config.revision, kind),
1063-
target,
1064-
config.revision,
1065-
);
1059+
let path = output_path(config, revised(config.revision, kind), target);
10661060
match &config.config.output_conflict_handling {
10671061
OutputConflictHandling::Error => {
10681062
let expected_output = std::fs::read(&path).unwrap_or_default();
@@ -1087,20 +1081,13 @@ fn check_output(
10871081
path
10881082
}
10891083

1090-
fn output_path(
1091-
path: &Path,
1092-
comments: &Comments,
1093-
kind: String,
1094-
target: &str,
1095-
revision: &str,
1096-
) -> PathBuf {
1097-
if comments
1098-
.for_revision(revision)
1099-
.any(|r| r.stderr_per_bitwidth)
1100-
{
1101-
return path.with_extension(format!("{}bit.{kind}", get_pointer_width(target)));
1084+
fn output_path(config: &TestConfig<'_>, kind: String, target: &str) -> PathBuf {
1085+
if config.comments().any(|r| r.stderr_per_bitwidth) {
1086+
return config
1087+
.path
1088+
.with_extension(format!("{}bit.{kind}", get_pointer_width(target)));
11021089
}
1103-
path.with_extension(kind)
1090+
config.path.with_extension(kind)
11041091
}
11051092

11061093
// Taken 1:1 from compiletest-rs

src/per_test_config.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,15 @@ impl TestConfig<'_> {
5454
self.comments.find_one_for_revision(self.revision, kind, f)
5555
}
5656

57-
pub fn all(&self) -> impl Iterator<Item = &'_ Revisioned> {
57+
pub fn comments(&self) -> impl Iterator<Item = &'_ Revisioned> {
5858
self.comments.for_revision(self.revision)
5959
}
6060

6161
pub fn collect<'a, T, I: Iterator<Item = T>, R: FromIterator<T>>(
6262
&'a self,
6363
f: impl Fn(&'a Revisioned) -> I,
6464
) -> R {
65-
self.comments
66-
.for_revision(self.revision)
67-
.flat_map(f)
68-
.collect()
65+
self.comments().flat_map(f).collect()
6966
}
7067

7168
pub fn build_command(&self) -> Result<Command, Errored> {

0 commit comments

Comments
 (0)