@@ -378,31 +378,31 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
378378
379379 // Now, we'll filtered passes in a way that discards any lint that
380380 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 ( )
387386 // 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)
404404 } )
405- . collect ( ) ;
405+ . collect ( ) ;
406406
407407 filtered_passes. push ( Box :: new ( builtin_lints) ) ;
408408
@@ -463,27 +463,30 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) {
463463 . filter ( |pass| {
464464 let pass = LintPass :: get_lints ( pass) ;
465465 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 ( )
468469 // 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+ }
472476 } )
473- // if passes_lints[i].iter().any(|&lint| {
474- // let symbol =
477+ // if passes_lints[i].iter().any(|&lint| {
478+ // let symbol =
475479 // &lint.name.to_lowercase()
476480 // // Doing some calculations here to account for those separators
477481 // [lint.name.find("::").unwrap_or(lint.name.len() - 2) + 2..]
478482
479483 // // ^^^ Expensive, but more expensive would be having to
480484 // // cast every element to &str
481485
482-
483-
484486 // (!lints_allowed.contains(&lint.name)
485487 // && lint.default_level != crate::Level::Allow)
486- } ) . collect ( ) ;
488+ } )
489+ . collect ( ) ;
487490
488491 let pass = RuntimeCombinedLateLintPass { passes : & mut filtered_passes[ ..] } ;
489492 late_lint_crate_inner ( tcx, context, pass) ;
0 commit comments