@@ -9,7 +9,7 @@ use rustc_errors::{
9
9
use rustc_hir:: { self as hir, HirIdSet } ;
10
10
use rustc_macros:: LintDiagnostic ;
11
11
use rustc_middle:: ty:: TyCtxt ;
12
- use rustc_session:: lint:: { FutureIncompatibilityReason , Level } ;
12
+ use rustc_session:: lint:: { FutureIncompatibilityReason , LintId } ;
13
13
use rustc_session:: { declare_lint, impl_lint_pass} ;
14
14
use rustc_span:: Span ;
15
15
use rustc_span:: edition:: Edition ;
@@ -242,12 +242,12 @@ impl_lint_pass!(
242
242
243
243
impl < ' tcx > LateLintPass < ' tcx > for IfLetRescope {
244
244
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx hir:: Expr < ' tcx > ) {
245
- if expr. span . edition ( ) . at_least_rust_2024 ( ) {
246
- return ;
247
- }
248
- if let ( Level :: Allow , _) = cx. tcx . lint_level_at_node ( IF_LET_RESCOPE , expr. hir_id ) {
245
+ if expr. span . edition ( ) . at_least_rust_2024 ( )
246
+ || cx. tcx . lints_that_dont_need_to_run ( ( ) ) . contains ( & LintId :: of ( IF_LET_RESCOPE ) )
247
+ {
249
248
return ;
250
249
}
250
+
251
251
if let hir:: ExprKind :: Loop ( block, _label, hir:: LoopSource :: While , _span) = expr. kind
252
252
&& let Some ( value) = block. expr
253
253
&& let hir:: ExprKind :: If ( cond, _conseq, _alt) = value. kind
@@ -287,7 +287,6 @@ struct IfLetRescopeLint {
287
287
rewrite : Option < IfLetRescopeRewrite > ,
288
288
}
289
289
290
- // #[derive(Subdiagnostic)]
291
290
struct IfLetRescopeRewrite {
292
291
match_heads : Vec < SingleArmMatchBegin > ,
293
292
consequent_heads : Vec < ConsequentRewrite > ,
0 commit comments