@@ -139,7 +139,7 @@ impl TestContext {
139
139
}
140
140
}
141
141
142
- fn base_config ( & self , test_dir : & str ) -> Config {
142
+ fn base_config ( & self , test_dir : & str , mandatory_annotations : bool ) -> Config {
143
143
let target_dir = PathBuf :: from ( var_os ( "CARGO_TARGET_DIR" ) . unwrap_or_else ( || "target" . into ( ) ) ) ;
144
144
let mut config = Config {
145
145
output_conflict_handling : OutputConflictHandling :: Error ,
@@ -153,7 +153,11 @@ impl TestContext {
153
153
} ;
154
154
let defaults = config. comment_defaults . base ( ) ;
155
155
defaults. exit_status = None . into ( ) ;
156
- defaults. require_annotations = None . into ( ) ;
156
+ if mandatory_annotations {
157
+ defaults. require_annotations = Some ( Spanned :: dummy ( true ) ) . into ( ) ;
158
+ } else {
159
+ defaults. require_annotations = None . into ( ) ;
160
+ }
157
161
defaults. diagnostic_code_prefix = Some ( Spanned :: dummy ( "clippy::" . into ( ) ) ) . into ( ) ;
158
162
defaults. set_custom ( "rustfix" , RustfixMode :: Everything ) ;
159
163
if let Some ( collector) = self . diagnostic_collector . clone ( ) {
@@ -197,7 +201,7 @@ impl TestContext {
197
201
}
198
202
199
203
fn run_ui ( cx : & TestContext ) {
200
- let mut config = cx. base_config ( "ui" ) ;
204
+ let mut config = cx. base_config ( "ui" , true ) ;
201
205
config
202
206
. program
203
207
. envs
@@ -216,7 +220,7 @@ fn run_internal_tests(cx: &TestContext) {
216
220
if !RUN_INTERNAL_TESTS {
217
221
return ;
218
222
}
219
- let mut config = cx. base_config ( "ui-internal" ) ;
223
+ let mut config = cx. base_config ( "ui-internal" , false ) ;
220
224
config. bless_command = Some ( "cargo uitest --features internal -- -- --bless" . into ( ) ) ;
221
225
222
226
ui_test:: run_tests_generic (
@@ -229,7 +233,7 @@ fn run_internal_tests(cx: &TestContext) {
229
233
}
230
234
231
235
fn run_ui_toml ( cx : & TestContext ) {
232
- let mut config = cx. base_config ( "ui-toml" ) ;
236
+ let mut config = cx. base_config ( "ui-toml" , true ) ;
233
237
234
238
config
235
239
. comment_defaults
@@ -259,7 +263,7 @@ fn run_ui_cargo(cx: &TestContext) {
259
263
return ;
260
264
}
261
265
262
- let mut config = cx. base_config ( "ui-cargo" ) ;
266
+ let mut config = cx. base_config ( "ui-cargo" , false ) ;
263
267
config. program . input_file_flag = CommandBuilder :: cargo ( ) . input_file_flag ;
264
268
config. program . out_dir_flag = CommandBuilder :: cargo ( ) . out_dir_flag ;
265
269
config. program . args = vec ! [ "clippy" . into( ) , "--color" . into( ) , "never" . into( ) , "--quiet" . into( ) ] ;
0 commit comments