Skip to content

Commit bd9efd5

Browse files
Rename hir::Local into hir::LetStmt
1 parent 879899c commit bd9efd5

28 files changed

+66
-66
lines changed

clippy_lints/src/box_default.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::{is_default_equivalent, path_def_id};
66
use rustc_errors::Applicability;
77
use rustc_hir::def::Res;
88
use rustc_hir::intravisit::{walk_ty, Visitor};
9-
use rustc_hir::{Block, Expr, ExprKind, Local, Node, QPath, Ty, TyKind};
9+
use rustc_hir::{Block, Expr, ExprKind, LetStmt, Node, QPath, Ty, TyKind};
1010
use rustc_lint::{LateContext, LateLintPass, LintContext};
1111
use rustc_middle::lint::in_external_macro;
1212
use rustc_middle::ty::print::with_forced_trimmed_paths;
@@ -139,7 +139,7 @@ impl<'tcx> Visitor<'tcx> for InferVisitor {
139139

140140
fn given_type(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
141141
match cx.tcx.parent_hir_node(expr.hir_id) {
142-
Node::Local(Local { ty: Some(ty), .. }) => {
142+
Node::Local(LetStmt { ty: Some(ty), .. }) => {
143143
let mut v = InferVisitor::default();
144144
v.visit_ty(ty);
145145
!v.0

clippy_lints/src/collection_is_never_read.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::ty::{is_type_diagnostic_item, is_type_lang_item};
33
use clippy_utils::visitors::for_each_expr_with_closures;
44
use clippy_utils::{get_enclosing_block, path_to_local_id};
55
use core::ops::ControlFlow;
6-
use rustc_hir::{Block, ExprKind, HirId, LangItem, Local, Node, PatKind};
6+
use rustc_hir::{Block, ExprKind, HirId, LangItem, LetStmt, Node, PatKind};
77
use rustc_lint::{LateContext, LateLintPass};
88
use rustc_session::declare_lint_pass;
99
use rustc_span::symbol::sym;
@@ -58,7 +58,7 @@ static COLLECTIONS: [Symbol; 9] = [
5858
];
5959

6060
impl<'tcx> LateLintPass<'tcx> for CollectionIsNeverRead {
61-
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'tcx>) {
61+
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'tcx>) {
6262
// Look for local variables whose type is a container. Search surrounding bock for read access.
6363
if match_acceptable_type(cx, local, &COLLECTIONS)
6464
&& let PatKind::Binding(_, local_id, _, _) = local.pat.kind
@@ -70,7 +70,7 @@ impl<'tcx> LateLintPass<'tcx> for CollectionIsNeverRead {
7070
}
7171
}
7272

73-
fn match_acceptable_type(cx: &LateContext<'_>, local: &Local<'_>, collections: &[rustc_span::Symbol]) -> bool {
73+
fn match_acceptable_type(cx: &LateContext<'_>, local: &LetStmt<'_>, collections: &[rustc_span::Symbol]) -> bool {
7474
let ty = cx.typeck_results().pat_ty(local.pat);
7575
collections.iter().any(|&sym| is_type_diagnostic_item(cx, ty, sym))
7676
// String type is a lang item but not a diagnostic item for now so we need a separate check

clippy_lints/src/let_underscore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
22
use clippy_utils::ty::{implements_trait, is_must_use_ty, match_type};
33
use clippy_utils::{is_from_proc_macro, is_must_use_func_call, paths};
4-
use rustc_hir::{Local, LocalSource, PatKind};
4+
use rustc_hir::{LetStmt, LocalSource, PatKind};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_middle::lint::in_external_macro;
77
use rustc_middle::ty::{GenericArgKind, IsSuggestable};
@@ -138,7 +138,7 @@ const SYNC_GUARD_PATHS: [&[&str]; 3] = [
138138
];
139139

140140
impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
141-
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &Local<'tcx>) {
141+
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &LetStmt<'tcx>) {
142142
if matches!(local.source, LocalSource::Normal)
143143
&& !in_external_macro(cx.tcx.sess, local.span)
144144
&& let PatKind::Wild = local.pat.kind

clippy_lints/src/let_with_type_underscore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
22
use clippy_utils::source::snippet;
3-
use rustc_hir::{Local, TyKind};
3+
use rustc_hir::{LetStmt, TyKind};
44
use rustc_lint::{LateContext, LateLintPass};
55
use rustc_middle::lint::in_external_macro;
66
use rustc_session::declare_lint_pass;
@@ -26,7 +26,7 @@ declare_clippy_lint! {
2626
declare_lint_pass!(UnderscoreTyped => [LET_WITH_TYPE_UNDERSCORE]);
2727

2828
impl LateLintPass<'_> for UnderscoreTyped {
29-
fn check_local(&mut self, cx: &LateContext<'_>, local: &Local<'_>) {
29+
fn check_local(&mut self, cx: &LateContext<'_>, local: &LetStmt<'_>) {
3030
if !in_external_macro(cx.tcx.sess, local.span)
3131
&& let Some(ty) = local.ty // Ensure that it has a type defined
3232
&& let TyKind::Infer = &ty.kind // that type is '_'

clippy_lints/src/loops/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::{get_parent_expr, is_integer_const, path_to_local, path_to_loc
33
use rustc_ast::ast::{LitIntType, LitKind};
44
use rustc_errors::Applicability;
55
use rustc_hir::intravisit::{walk_expr, walk_local, Visitor};
6-
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, HirId, HirIdMap, Local, Mutability, PatKind};
6+
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, HirId, HirIdMap, LetStmt, Mutability, PatKind};
77
use rustc_lint::LateContext;
88
use rustc_middle::hir::nested_filter;
99
use rustc_middle::ty::{self, Ty};
@@ -141,7 +141,7 @@ impl<'a, 'tcx> InitializeVisitor<'a, 'tcx> {
141141
impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
142142
type NestedFilter = nested_filter::OnlyBodies;
143143

144-
fn visit_local(&mut self, l: &'tcx Local<'_>) {
144+
fn visit_local(&mut self, l: &'tcx LetStmt<'_>) {
145145
// Look for declarations of the variable
146146
if l.pat.hir_id == self.var_id
147147
&& let PatKind::Binding(.., ident, _) = l.pat.kind

clippy_lints/src/loops/while_let_loop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ use clippy_utils::source::snippet_with_applicability;
55
use clippy_utils::ty::needs_ordered_drop;
66
use clippy_utils::visitors::any_temporaries_need_ordered_drop;
77
use rustc_errors::Applicability;
8-
use rustc_hir::{Block, Expr, ExprKind, Local, MatchSource, Pat, StmtKind};
8+
use rustc_hir::{Block, Expr, ExprKind, LetStmt, MatchSource, Pat, StmtKind};
99
use rustc_lint::LateContext;
1010

1111
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, loop_block: &'tcx Block<'_>) {
1212
let (init, has_trailing_exprs) = match (loop_block.stmts, loop_block.expr) {
1313
([stmt, stmts @ ..], expr) => {
14-
if let StmtKind::Let(&Local {
14+
if let StmtKind::Let(&LetStmt {
1515
init: Some(e),
1616
els: None,
1717
..

clippy_lints/src/loops/while_let_on_iterator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::{get_enclosing_loop_or_multi_call_closure, higher, is_refutabl
66
use rustc_errors::Applicability;
77
use rustc_hir::def::Res;
88
use rustc_hir::intravisit::{walk_expr, Visitor};
9-
use rustc_hir::{Closure, Expr, ExprKind, HirId, LangItem, Local, Mutability, PatKind, UnOp};
9+
use rustc_hir::{Closure, Expr, ExprKind, HirId, LangItem, LetStmt, Mutability, PatKind, UnOp};
1010
use rustc_lint::LateContext;
1111
use rustc_middle::hir::nested_filter::OnlyBodies;
1212
use rustc_middle::ty::adjustment::Adjust;
@@ -286,7 +286,7 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: &
286286
self.cx.tcx.hir()
287287
}
288288

289-
fn visit_local(&mut self, l: &'tcx Local<'_>) {
289+
fn visit_local(&mut self, l: &'tcx LetStmt<'_>) {
290290
if !self.after_loop {
291291
l.pat.each_binding_or_first(&mut |_, id, _, _| {
292292
if id == self.local_id {

clippy_lints/src/manual_hash_one.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::source::snippet_opt;
44
use clippy_utils::visitors::{is_local_used, local_used_once};
55
use clippy_utils::{is_trait_method, path_to_local_id};
66
use rustc_errors::Applicability;
7-
use rustc_hir::{BindingAnnotation, ExprKind, Local, Node, PatKind, StmtKind};
7+
use rustc_hir::{BindingAnnotation, ExprKind, LetStmt, Node, PatKind, StmtKind};
88
use rustc_lint::{LateContext, LateLintPass};
99
use rustc_session::impl_lint_pass;
1010
use rustc_span::sym;
@@ -60,7 +60,7 @@ impl ManualHashOne {
6060
impl_lint_pass!(ManualHashOne => [MANUAL_HASH_ONE]);
6161

6262
impl LateLintPass<'_> for ManualHashOne {
63-
fn check_local(&mut self, cx: &LateContext<'_>, local: &Local<'_>) {
63+
fn check_local(&mut self, cx: &LateContext<'_>, local: &LetStmt<'_>) {
6464
// `let mut hasher = seg.build_hasher();`
6565
if let PatKind::Binding(BindingAnnotation::MUT, hasher, _, None) = local.pat.kind
6666
&& let Some(init) = local.init

clippy_lints/src/matches/infallible_destructuring_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use clippy_utils::diagnostics::span_lint_and_sugg;
22
use clippy_utils::source::snippet_with_applicability;
33
use clippy_utils::{path_to_local_id, peel_blocks, strip_pat_refs};
44
use rustc_errors::Applicability;
5-
use rustc_hir::{ByRef, ExprKind, Local, MatchSource, PatKind, QPath};
5+
use rustc_hir::{ByRef, ExprKind, LetStmt, MatchSource, PatKind, QPath};
66
use rustc_lint::LateContext;
77

88
use super::INFALLIBLE_DESTRUCTURING_MATCH;
99

10-
pub(crate) fn check(cx: &LateContext<'_>, local: &Local<'_>) -> bool {
10+
pub(crate) fn check(cx: &LateContext<'_>, local: &LetStmt<'_>) -> bool {
1111
if !local.span.from_expansion()
1212
&& let Some(expr) = local.init
1313
&& let ExprKind::Match(target, arms, MatchSource::Normal) = expr.kind

clippy_lints/src/matches/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod wild_in_or_pats;
2727
use clippy_config::msrvs::{self, Msrv};
2828
use clippy_utils::source::{snippet_opt, walk_span_to_context};
2929
use clippy_utils::{higher, in_constant, is_direct_expn_of, is_span_match, tokenize_with_text};
30-
use rustc_hir::{Arm, Expr, ExprKind, Local, MatchSource, Pat};
30+
use rustc_hir::{Arm, Expr, ExprKind, LetStmt, MatchSource, Pat};
3131
use rustc_lexer::TokenKind;
3232
use rustc_lint::{LateContext, LateLintPass, LintContext};
3333
use rustc_middle::lint::in_external_macro;
@@ -1124,7 +1124,7 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
11241124
}
11251125
}
11261126

1127-
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'_>) {
1127+
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'_>) {
11281128
self.infallible_destructuring_match_linted |=
11291129
local.els.is_none() && infallible_destructuring_match::check(cx, local);
11301130
}

clippy_lints/src/methods/needless_collect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_data_structures::fx::FxHashMap;
1111
use rustc_errors::{Applicability, MultiSpan};
1212
use rustc_hir::intravisit::{walk_block, walk_expr, Visitor};
1313
use rustc_hir::{
14-
BindingAnnotation, Block, Expr, ExprKind, HirId, HirIdSet, Local, Mutability, Node, PatKind, Stmt, StmtKind,
14+
BindingAnnotation, Block, Expr, ExprKind, HirId, HirIdSet, LetStmt, Mutability, Node, PatKind, Stmt, StmtKind,
1515
};
1616
use rustc_lint::LateContext;
1717
use rustc_middle::hir::nested_filter;
@@ -424,7 +424,7 @@ fn get_expr_and_hir_id_from_stmt<'v>(stmt: &'v Stmt<'v>) -> Option<(&'v Expr<'v>
424424
match stmt.kind {
425425
StmtKind::Expr(expr) | StmtKind::Semi(expr) => Some((expr, None)),
426426
StmtKind::Item(..) => None,
427-
StmtKind::Let(Local { init, pat, .. }) => {
427+
StmtKind::Let(LetStmt { init, pat, .. }) => {
428428
if let PatKind::Binding(_, hir_id, ..) = pat.kind {
429429
init.map(|init_expr| (init_expr, Some(hir_id)))
430430
} else {

clippy_lints/src/methods/str_splitn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use clippy_utils::{is_diag_item_method, match_def_path, path_to_local_id, paths}
88
use core::ops::ControlFlow;
99
use rustc_errors::Applicability;
1010
use rustc_hir::{
11-
BindingAnnotation, Expr, ExprKind, HirId, LangItem, Local, MatchSource, Node, Pat, PatKind, QPath, Stmt, StmtKind,
11+
BindingAnnotation, Expr, ExprKind, HirId, LangItem, LetStmt, MatchSource, Node, Pat, PatKind, QPath, Stmt, StmtKind,
1212
};
1313
use rustc_lint::LateContext;
1414
use rustc_middle::ty;
@@ -198,7 +198,7 @@ fn indirect_usage<'tcx>(
198198
binding: HirId,
199199
ctxt: SyntaxContext,
200200
) -> Option<IndirectUsage<'tcx>> {
201-
if let StmtKind::Let(&Local {
201+
if let StmtKind::Let(&LetStmt {
202202
pat: Pat {
203203
kind: PatKind::Binding(BindingAnnotation::NONE, _, ident, None),
204204
..

clippy_lints/src/mixed_read_write_in_expression.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::{span_lint, span_lint_and_note};
22
use clippy_utils::{get_parent_expr, path_to_local, path_to_local_id};
33
use rustc_hir::intravisit::{walk_expr, Visitor};
4-
use rustc_hir::{BinOpKind, Block, Expr, ExprKind, HirId, Local, Node, Stmt, StmtKind};
4+
use rustc_hir::{BinOpKind, Block, Expr, ExprKind, HirId, LetStmt, Node, Stmt, StmtKind};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_middle::ty;
77
use rustc_session::declare_lint_pass;
@@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for EvalOrderDependence {
9898
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
9999
match stmt.kind {
100100
StmtKind::Let(local) => {
101-
if let Local { init: Some(e), .. } = local {
101+
if let LetStmt { init: Some(e), .. } = local {
102102
DivergenceVisitor { cx }.visit_expr(e);
103103
}
104104
},

clippy_lints/src/mut_key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'tcx> LateLintPass<'tcx> for MutableKeyType {
121121
}
122122
}
123123

124-
fn check_local(&mut self, cx: &LateContext<'_>, local: &hir::Local<'_>) {
124+
fn check_local(&mut self, cx: &LateContext<'_>, local: &hir::LetStmt<'_>) {
125125
if let hir::PatKind::Wild = local.pat.kind {
126126
return;
127127
}

clippy_lints/src/needless_late_init.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::visitors::{for_each_expr, for_each_expr_with_closures, is_loca
66
use core::ops::ControlFlow;
77
use rustc_errors::{Applicability, MultiSpan};
88
use rustc_hir::{
9-
BindingAnnotation, Block, Expr, ExprKind, HirId, Local, LocalSource, MatchSource, Node, Pat, PatKind, Stmt,
9+
BindingAnnotation, Block, Expr, ExprKind, HirId, LetStmt, LocalSource, MatchSource, Node, Pat, PatKind, Stmt,
1010
StmtKind,
1111
};
1212
use rustc_lint::{LateContext, LateLintPass};
@@ -237,7 +237,7 @@ fn first_usage<'tcx>(
237237
})
238238
}
239239

240-
fn local_snippet_without_semicolon(cx: &LateContext<'_>, local: &Local<'_>) -> Option<String> {
240+
fn local_snippet_without_semicolon(cx: &LateContext<'_>, local: &LetStmt<'_>) -> Option<String> {
241241
let span = local.span.with_hi(match local.ty {
242242
// let <pat>: <ty>;
243243
// ~~~~~~~~~~~~~~~
@@ -252,7 +252,7 @@ fn local_snippet_without_semicolon(cx: &LateContext<'_>, local: &Local<'_>) -> O
252252

253253
fn check<'tcx>(
254254
cx: &LateContext<'tcx>,
255-
local: &'tcx Local<'tcx>,
255+
local: &'tcx LetStmt<'tcx>,
256256
local_stmt: &'tcx Stmt<'tcx>,
257257
block: &'tcx Block<'tcx>,
258258
binding_id: HirId,
@@ -363,9 +363,9 @@ fn check<'tcx>(
363363
}
364364

365365
impl<'tcx> LateLintPass<'tcx> for NeedlessLateInit {
366-
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'tcx>) {
366+
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'tcx>) {
367367
let mut parents = cx.tcx.hir().parent_iter(local.hir_id);
368-
if let Local {
368+
if let LetStmt {
369369
init: None,
370370
pat:
371371
&Pat {

clippy_lints/src/question_mark.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_errors::Applicability;
1414
use rustc_hir::def::Res;
1515
use rustc_hir::LangItem::{self, OptionNone, OptionSome, ResultErr, ResultOk};
1616
use rustc_hir::{
17-
BindingAnnotation, Block, ByRef, Expr, ExprKind, Local, Node, PatKind, PathSegment, QPath, Stmt, StmtKind,
17+
BindingAnnotation, Block, ByRef, Expr, ExprKind, LetStmt, Node, PatKind, PathSegment, QPath, Stmt, StmtKind,
1818
};
1919
use rustc_lint::{LateContext, LateLintPass};
2020
use rustc_middle::ty::Ty;
@@ -109,7 +109,7 @@ fn find_let_else_ret_expression<'hir>(block: &'hir Block<'hir>) -> Option<&'hir
109109
}
110110

111111
fn check_let_some_else_return_none(cx: &LateContext<'_>, stmt: &Stmt<'_>) {
112-
if let StmtKind::Let(Local {
112+
if let StmtKind::Let(LetStmt {
113113
pat,
114114
init: Some(init_expr),
115115
els: Some(els),

clippy_lints/src/read_zero_byte_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::get_enclosing_block;
33
use clippy_utils::higher::{get_vec_init_kind, VecInitKind};
44
use clippy_utils::source::snippet;
55

6-
use hir::{Expr, ExprKind, HirId, Local, PatKind, PathSegment, QPath, StmtKind};
6+
use hir::{Expr, ExprKind, HirId, LetStmt, PatKind, PathSegment, QPath, StmtKind};
77
use rustc_errors::Applicability;
88
use rustc_hir as hir;
99
use rustc_hir::def::Res;
@@ -57,7 +57,7 @@ impl<'tcx> LateLintPass<'tcx> for ReadZeroByteVec {
5757
}
5858

5959
if let StmtKind::Let(local) = stmt.kind
60-
&& let Local {
60+
&& let LetStmt {
6161
pat, init: Some(init), ..
6262
} = local
6363
&& let PatKind::Binding(_, id, ident, _) = pat.kind

clippy_lints/src/redundant_locals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::is_from_proc_macro;
33
use clippy_utils::ty::needs_ordered_drop;
44
use rustc_ast::Mutability;
55
use rustc_hir::def::Res;
6-
use rustc_hir::{BindingAnnotation, ByRef, ExprKind, HirId, Local, Node, Pat, PatKind, QPath};
6+
use rustc_hir::{BindingAnnotation, ByRef, ExprKind, HirId, LetStmt, Node, Pat, PatKind, QPath};
77
use rustc_hir_typeck::expr_use_visitor::PlaceBase;
88
use rustc_lint::{LateContext, LateLintPass, LintContext};
99
use rustc_middle::lint::in_external_macro;
@@ -47,7 +47,7 @@ declare_clippy_lint! {
4747
declare_lint_pass!(RedundantLocals => [REDUNDANT_LOCALS]);
4848

4949
impl<'tcx> LateLintPass<'tcx> for RedundantLocals {
50-
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'tcx>) {
50+
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'tcx>) {
5151
if !local.span.is_desugaring(DesugaringKind::Async)
5252
// the pattern is a single by-value binding
5353
&& let PatKind::Binding(BindingAnnotation(ByRef::No, mutability), _, ident, None) = local.pat.kind

clippy_lints/src/redundant_type_annotations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn extract_primty(ty_kind: &hir::TyKind<'_>) -> Option<hir::PrimTy> {
131131
}
132132

133133
impl LateLintPass<'_> for RedundantTypeAnnotations {
134-
fn check_local<'tcx>(&mut self, cx: &LateContext<'tcx>, local: &'tcx rustc_hir::Local<'tcx>) {
134+
fn check_local<'tcx>(&mut self, cx: &LateContext<'tcx>, local: &'tcx rustc_hir::LetStmt<'tcx>) {
135135
if !is_lint_allowed(cx, REDUNDANT_TYPE_ANNOTATIONS, local.hir_id)
136136
// type annotation part
137137
&& !local.span.from_expansion()

clippy_lints/src/reserve_after_initialization.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::source::snippet;
44
use clippy_utils::{is_from_proc_macro, path_to_local_id};
55
use rustc_errors::Applicability;
66
use rustc_hir::def::Res;
7-
use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, Local, PatKind, QPath, Stmt, StmtKind};
7+
use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, LetStmt, PatKind, QPath, Stmt, StmtKind};
88
use rustc_lint::{LateContext, LateLintPass, LintContext};
99
use rustc_middle::lint::in_external_macro;
1010
use rustc_session::impl_lint_pass;
@@ -69,7 +69,7 @@ impl<'tcx> LateLintPass<'tcx> for ReserveAfterInitialization {
6969
self.searcher = None;
7070
}
7171

72-
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'tcx>) {
72+
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'tcx>) {
7373
if let Some(init_expr) = local.init
7474
&& let PatKind::Binding(BindingAnnotation::MUT, id, _, None) = local.pat.kind
7575
&& !in_external_macro(cx.sess(), local.span)

clippy_lints/src/types/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod vec_box;
1212
use rustc_hir as hir;
1313
use rustc_hir::intravisit::FnKind;
1414
use rustc_hir::{
15-
Body, FnDecl, FnRetTy, GenericArg, ImplItem, ImplItemKind, Item, ItemKind, Local, MutTy, QPath, TraitItem,
15+
Body, FnDecl, FnRetTy, GenericArg, ImplItem, ImplItemKind, Item, ItemKind, LetStmt, MutTy, QPath, TraitItem,
1616
TraitItemKind, TyKind,
1717
};
1818
use rustc_lint::{LateContext, LateLintPass};
@@ -425,7 +425,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
425425
}
426426
}
427427

428-
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &Local<'tcx>) {
428+
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &LetStmt<'tcx>) {
429429
if let Some(ty) = local.ty {
430430
self.check_ty(
431431
cx,

0 commit comments

Comments
 (0)