@@ -48,12 +48,7 @@ impl System {
48
48
}
49
49
50
50
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 )
57
52
}
58
53
59
54
fn others ( self ) -> Vec < System > {
@@ -73,7 +68,16 @@ impl System {
73
68
fn enabled ( self , enabled : HashMap < System , bool > , disabled : HashMap < System , bool > ) -> bool {
74
69
let not_disabled = !disabled[ & self ] ;
75
70
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
+
77
81
not_disabled && ( explicitly_enabled || no_others_enabled)
78
82
}
79
83
}
@@ -207,6 +211,7 @@ impl<'src, D> Recipe<'src, D> {
207
211
( System :: Linux , linux. unwrap_or ( false ) ) ,
208
212
( System :: OpenBSD , openbsd. unwrap_or ( false ) ) ,
209
213
( System :: Unix , unix. unwrap_or ( false ) ) ,
214
+ ( System :: Unrecognized , false ) ,
210
215
]
211
216
. into_iter ( )
212
217
. collect ( ) ;
@@ -217,6 +222,7 @@ impl<'src, D> Recipe<'src, D> {
217
222
( System :: Linux , linux. is_some_and ( bool:: not) ) ,
218
223
( System :: OpenBSD , openbsd. is_some_and ( bool:: not) ) ,
219
224
( System :: Unix , unix. is_some_and ( bool:: not) ) ,
225
+ ( System :: Unrecognized , false ) ,
220
226
]
221
227
. into_iter ( )
222
228
. collect ( ) ;
0 commit comments