Skip to content

Commit 04e5230

Browse files
committed
Simplify a method that is only ever used in one way
1 parent a8dd6be commit 04e5230

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/config.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,12 @@ impl Config {
261261
}
262262

263263
/// Check whether the host is the specified string
264-
pub fn host_matches(&self, target: &str) -> bool {
265-
self.host.as_ref().expect("host should have been filled in") == target
264+
pub fn host_matches_target(&self) -> bool {
265+
self.host.as_ref().expect("host should have been filled in")
266+
== self
267+
.target
268+
.as_ref()
269+
.expect("target should have been filled in")
266270
}
267271

268272
pub(crate) fn has_asm_support(&self) -> bool {
@@ -283,7 +287,7 @@ impl Config {
283287
Condition::Bitwidth(bits) => crate::get_pointer_width(target) == *bits,
284288
Condition::Target(t) => target.contains(t),
285289
Condition::Host(t) => self.host.as_ref().unwrap().contains(t),
286-
Condition::OnHost => self.host_matches(target),
290+
Condition::OnHost => self.host_matches_target(),
287291
}
288292
}
289293

src/per_test_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl TestConfig<'_> {
9393
// Adding a `--target` arg to calls to Cargo will cause target folders
9494
// to create a target-specific sub-folder. We can avoid that by just
9595
// not passing a `--target` arg if its the same as the host.
96-
if !config.host_matches(target) {
96+
if !config.host_matches_target() {
9797
cmd.arg("--target").arg(target);
9898
}
9999
}

0 commit comments

Comments
 (0)