@@ -11,10 +11,10 @@ use regex::Regex;
11
11
12
12
// A few of those error codes can't be tested but all the others can and *should* be tested!
13
13
const EXEMPTED_FROM_TEST : & [ & str ] = & [
14
- "E0227" , "E0279" , "E0280" , "E0313" , "E0314" , " E0315", "E0377" , "E0461" , "E0462" , "E0464" ,
15
- "E0465" , " E0473", "E0474" , "E0475" , "E0476" , "E0479" , "E0480" , "E0481" , "E0482" , "E0483" ,
16
- "E0484" , " E0485", "E0486" , "E0487" , "E0488" , "E0489" , "E0514" , "E0519" , "E0523" , "E0553 " ,
17
- "E0554" , "E0570" , "E0629" , "E0630" , " E0640", "E0717" , "E0729" ,
14
+ "E0227" , "E0279" , "E0280" , "E0313" , "E0315" , "E0377" , "E0461" , "E0462" , "E0464" , "E0465 ",
15
+ "E0473" , "E0474" , "E0475" , "E0476" , "E0479" , "E0480" , "E0481" , "E0482" , "E0483" , "E0484 ",
16
+ "E0485" , "E0486" , "E0487" , "E0488" , "E0489" , "E0514" , "E0519" , "E0523" , "E0554" , "E0570 ",
17
+ "E0640" , "E0717" , "E0729" ,
18
18
] ;
19
19
20
20
// Some error codes don't have any tests apparently...
@@ -293,6 +293,27 @@ pub fn check(paths: &[&Path], bad: &mut bool) {
293
293
}
294
294
}
295
295
}
296
+ if errors. is_empty ( ) {
297
+ // Checking if local constants need to be cleaned.
298
+ for err_code in EXEMPTED_FROM_TEST {
299
+ match error_codes. get ( err_code. to_owned ( ) ) {
300
+ Some ( status) => {
301
+ if status. has_test {
302
+ errors. push ( format ! (
303
+ "{} error code has a test and therefore should be \
304
+ removed from the `EXEMPTED_FROM_TEST` constant",
305
+ err_code
306
+ ) ) ;
307
+ }
308
+ }
309
+ None => errors. push ( format ! (
310
+ "{} error code isn't used anymore and therefore should be removed \
311
+ from `EXEMPTED_FROM_TEST` constant",
312
+ err_code
313
+ ) ) ,
314
+ }
315
+ }
316
+ }
296
317
errors. sort ( ) ;
297
318
for err in & errors {
298
319
eprintln ! ( "{}" , err) ;
0 commit comments