@@ -86,10 +86,7 @@ impl BuildConfig {
86
86
/// Whether or not the *user* wants JSON output. Whether or not rustc
87
87
/// actually uses JSON is decided in `add_error_format`.
88
88
pub fn emit_json ( & self ) -> bool {
89
- match self . message_format {
90
- MessageFormat :: Json { .. } => true ,
91
- _ => false ,
92
- }
89
+ matches ! ( self . message_format, MessageFormat :: Json { .. } )
93
90
}
94
91
95
92
pub fn test ( & self ) -> bool {
@@ -171,18 +168,12 @@ impl ser::Serialize for CompileMode {
171
168
impl CompileMode {
172
169
/// Returns `true` if the unit is being checked.
173
170
pub fn is_check ( self ) -> bool {
174
- match self {
175
- CompileMode :: Check { .. } => true ,
176
- _ => false ,
177
- }
171
+ matches ! ( self , CompileMode :: Check { .. } )
178
172
}
179
173
180
174
/// Returns `true` if this is generating documentation.
181
175
pub fn is_doc ( self ) -> bool {
182
- match self {
183
- CompileMode :: Doc { .. } => true ,
184
- _ => false ,
185
- }
176
+ matches ! ( self , CompileMode :: Doc { .. } )
186
177
}
187
178
188
179
/// Returns `true` if this a doc test.
@@ -193,21 +184,21 @@ impl CompileMode {
193
184
/// Returns `true` if this is any type of test (test, benchmark, doc test, or
194
185
/// check test).
195
186
pub fn is_any_test ( self ) -> bool {
196
- match self {
187
+ matches ! (
188
+ self ,
197
189
CompileMode :: Test
198
- | CompileMode :: Bench
199
- | CompileMode :: Check { test : true }
200
- | CompileMode :: Doctest => true ,
201
- _ => false ,
202
- }
190
+ | CompileMode :: Bench
191
+ | CompileMode :: Check { test: true }
192
+ | CompileMode :: Doctest
193
+ )
203
194
}
204
195
205
196
/// Returns `true` if this is something that passes `--test` to rustc.
206
197
pub fn is_rustc_test ( self ) -> bool {
207
- match self {
208
- CompileMode :: Test | CompileMode :: Bench | CompileMode :: Check { test : true } => true ,
209
- _ => false ,
210
- }
198
+ matches ! (
199
+ self ,
200
+ CompileMode :: Test | CompileMode :: Bench | CompileMode :: Check { test : true }
201
+ )
211
202
}
212
203
213
204
/// Returns `true` if this is the *execution* of a `build.rs` script.
0 commit comments