Skip to content

Commit bfba342

Browse files
committed
AI fix?
1 parent 88335fe commit bfba342

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/recipe.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@ impl System {
4848
}
4949

5050
fn is_specific_unix(self) -> bool {
51-
match self {
52-
System::Linux => true,
53-
System::MacOS => true,
54-
System::OpenBSD => true,
55-
_ => false,
56-
}
51+
matches!(self, System::Linux | System::MacOS | System::OpenBSD)
5752
}
5853

5954
fn others(self) -> Vec<System> {
@@ -73,7 +68,16 @@ impl System {
7368
fn enabled(self, enabled: HashMap<System, bool>, disabled: HashMap<System, bool>) -> bool {
7469
let not_disabled = !disabled[&self];
7570
let explicitly_enabled = enabled[&self];
76-
let no_others_enabled = !self.others().iter().any(|system| enabled[system]);
71+
let no_others_enabled = !self
72+
.others()
73+
.iter()
74+
.any(|system| *enabled.get(system).unwrap_or(&false));
75+
76+
// Special case for Unix family
77+
if self.is_specific_unix() && enabled.get(&System::Unix).copied().unwrap_or(false) {
78+
return !disabled.get(&self).copied().unwrap_or(false);
79+
}
80+
7781
not_disabled && (explicitly_enabled || no_others_enabled)
7882
}
7983
}
@@ -207,6 +211,7 @@ impl<'src, D> Recipe<'src, D> {
207211
(System::Linux, linux.unwrap_or(false)),
208212
(System::OpenBSD, openbsd.unwrap_or(false)),
209213
(System::Unix, unix.unwrap_or(false)),
214+
(System::Unrecognized, false),
210215
]
211216
.into_iter()
212217
.collect();
@@ -217,6 +222,7 @@ impl<'src, D> Recipe<'src, D> {
217222
(System::Linux, linux.is_some_and(bool::not)),
218223
(System::OpenBSD, openbsd.is_some_and(bool::not)),
219224
(System::Unix, unix.is_some_and(bool::not)),
225+
(System::Unrecognized, false),
220226
]
221227
.into_iter()
222228
.collect();

0 commit comments

Comments
 (0)