@@ -378,31 +378,31 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
378
378
379
379
// Now, we'll filtered passes in a way that discards any lint that
380
380
let mut filtered_passes: Vec < Box < dyn LateLintPass < ' tcx > > > = passes
381
- . into_iter ( )
382
- . filter ( |pass| {
383
- let pass = LintPass :: get_lints ( pass) ;
384
- pass. iter ( ) . any ( |& lint| {
385
- let lint_name =
386
- & lint. name . to_lowercase ( )
381
+ . into_iter ( )
382
+ . filter ( |pass| {
383
+ let pass = LintPass :: get_lints ( pass) ;
384
+ pass. iter ( ) . any ( |& lint| {
385
+ let lint_name = & lint. name . to_lowercase ( )
387
386
// Doing some calculations here to account for those separators
388
- [ lint. name . find ( "::" ) . unwrap_or ( lint. name . len ( ) - 2 ) + 2 ..] . to_string ( ) ;
389
- lints_to_emit. contains ( & lint_name) || ( !lints_allowed. contains ( & lint_name) && lint. default_level != crate :: Level :: Allow )
390
- } )
391
- // if passes_lints[i].iter().any(|&lint| {
392
- // let symbol =
393
- // &lint.name.to_lowercase()
394
- // // Doing some calculations here to account for those separators
395
- // [lint.name.find("::").unwrap_or(lint.name.len() - 2) + 2..]
396
-
397
- // // ^^^ Expensive, but more expensive would be having to
398
- // // cast every element to &str
399
-
400
-
401
-
402
- // (!lints_allowed.contains(&lint.name)
403
- // && lint.default_level != crate::Level::Allow)
387
+ [ lint. name . find ( "::" ) . unwrap_or ( lint. name . len ( ) - 2 ) + 2 ..]
388
+ . to_string ( ) ;
389
+ lints_to_emit. contains ( & lint_name)
390
+ || ( !lints_allowed. contains ( & lint_name)
391
+ && lint. default_level != crate :: Level :: Allow )
392
+ } )
393
+ // if passes_lints[i].iter().any(|&lint| {
394
+ // let symbol =
395
+ // &lint.name.to_lowercase()
396
+ // // Doing some calculations here to account for those separators
397
+ // [lint.name.find("::").unwrap_or(lint.name.len() - 2) + 2..]
398
+
399
+ // // ^^^ Expensive, but more expensive would be having to
400
+ // // cast every element to &str
401
+
402
+ // (!lints_allowed.contains(&lint.name)
403
+ // && lint.default_level != crate::Level::Allow)
404
404
} )
405
- . collect ( ) ;
405
+ . collect ( ) ;
406
406
407
407
filtered_passes. push ( Box :: new ( builtin_lints) ) ;
408
408
@@ -463,27 +463,30 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) {
463
463
. filter ( |pass| {
464
464
let pass = LintPass :: get_lints ( pass) ;
465
465
pass. iter ( ) . any ( |& lint| {
466
- let lint_name =
467
- & lint. name . to_lowercase ( )
466
+ lint. is_externally_loaded ||
467
+ {
468
+ let lint_name = & lint. name . to_lowercase ( )
468
469
// Doing some calculations here to account for those separators
469
- [ lint. name . find ( "::" ) . unwrap_or ( lint. name . len ( ) - 2 ) + 2 ..] . to_string ( ) ;
470
- lints_to_emit. contains ( & lint_name) ||
471
- ( !lints_allowed. contains ( lint_name) && lint. default_level != crate :: Level :: Allow )
470
+ [ lint. name . find ( "::" ) . unwrap_or ( lint. name . len ( ) - 2 ) + 2 ..]
471
+ . to_string ( ) ;
472
+ lints_to_emit. contains ( & lint_name)
473
+ || ( !lints_allowed. contains ( lint_name)
474
+ && lint. default_level != crate :: Level :: Allow )
475
+ }
472
476
} )
473
- // if passes_lints[i].iter().any(|&lint| {
474
- // let symbol =
477
+ // if passes_lints[i].iter().any(|&lint| {
478
+ // let symbol =
475
479
// &lint.name.to_lowercase()
476
480
// // Doing some calculations here to account for those separators
477
481
// [lint.name.find("::").unwrap_or(lint.name.len() - 2) + 2..]
478
482
479
483
// // ^^^ Expensive, but more expensive would be having to
480
484
// // cast every element to &str
481
485
482
-
483
-
484
486
// (!lints_allowed.contains(&lint.name)
485
487
// && lint.default_level != crate::Level::Allow)
486
- } ) . collect ( ) ;
488
+ } )
489
+ . collect ( ) ;
487
490
488
491
let pass = RuntimeCombinedLateLintPass { passes : & mut filtered_passes[ ..] } ;
489
492
late_lint_crate_inner ( tcx, context, pass) ;
0 commit comments