Skip to content

Commit 7e3c613

Browse files
Rename hir::StmtKind::Local into hir::StmtKind::Let
1 parent cbba5b8 commit 7e3c613

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+76
-76
lines changed

compiler/rustc_ast_lowering/src/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
3636
let hir_id = self.lower_node_id(s.id);
3737
let local = self.lower_local(local);
3838
self.alias_attrs(hir_id, local.hir_id);
39-
let kind = hir::StmtKind::Local(local);
39+
let kind = hir::StmtKind::Let(local);
4040
let span = self.lower_span(s.span);
4141
stmts.push(hir::Stmt { hir_id, kind, span });
4242
}

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23562356
span: self.lower_span(span),
23572357
ty: None,
23582358
};
2359-
self.stmt(span, hir::StmtKind::Local(self.arena.alloc(local)))
2359+
self.stmt(span, hir::StmtKind::Let(self.arena.alloc(local)))
23602360
}
23612361

23622362
fn block_expr(&mut self, expr: &'hir hir::Expr<'hir>) -> &'hir hir::Block<'hir> {

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
616616

617617
// FIXME: We make sure that this is a normal top-level binding,
618618
// but we could suggest `todo!()` for all uninitalized bindings in the pattern pattern
619-
if let hir::StmtKind::Local(hir::Local { span, ty, init: None, pat, .. }) =
619+
if let hir::StmtKind::Let(hir::Local { span, ty, init: None, pat, .. }) =
620620
&ex.kind
621621
&& let hir::PatKind::Binding(..) = pat.kind
622622
&& span.contains(self.decl_span)

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
558558
hir::intravisit::walk_stmt(self, stmt);
559559
let expr = match stmt.kind {
560560
hir::StmtKind::Semi(expr) | hir::StmtKind::Expr(expr) => expr,
561-
hir::StmtKind::Local(hir::Local { init: Some(expr), .. }) => expr,
561+
hir::StmtKind::Let(hir::Local { init: Some(expr), .. }) => expr,
562562
_ => {
563563
return;
564564
}
@@ -1305,7 +1305,7 @@ struct BindingFinder {
13051305
impl<'tcx> Visitor<'tcx> for BindingFinder {
13061306
type Result = ControlFlow<hir::HirId>;
13071307
fn visit_stmt(&mut self, s: &'tcx hir::Stmt<'tcx>) -> Self::Result {
1308-
if let hir::StmtKind::Local(local) = s.kind
1308+
if let hir::StmtKind::Let(local) = s.kind
13091309
&& local.pat.span == self.span
13101310
{
13111311
ControlFlow::Break(local.hir_id)

compiler/rustc_hir/src/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ pub struct Stmt<'hir> {
12091209
#[derive(Debug, Clone, Copy, HashStable_Generic)]
12101210
pub enum StmtKind<'hir> {
12111211
/// A local (`let`) binding.
1212-
Local(&'hir Local<'hir>),
1212+
Let(&'hir Local<'hir>),
12131213

12141214
/// An item binding.
12151215
Item(ItemId),

compiler/rustc_hir/src/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block<'v>) ->
627627
pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt<'v>) -> V::Result {
628628
try_visit!(visitor.visit_id(statement.hir_id));
629629
match statement.kind {
630-
StmtKind::Local(ref local) => visitor.visit_local(local),
630+
StmtKind::Let(ref local) => visitor.visit_local(local),
631631
StmtKind::Item(item) => visitor.visit_nested_item(item),
632632
StmtKind::Expr(ref expression) | StmtKind::Semi(ref expression) => {
633633
visitor.visit_expr(expression)

compiler/rustc_hir_analysis/src/check/errs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn maybe_expr_static_mut(tcx: TyCtxt<'_>, expr: hir::Expr<'_>) {
2727

2828
/// Check for shared or mutable references of `static mut` inside statement
2929
pub fn maybe_stmt_static_mut(tcx: TyCtxt<'_>, stmt: hir::Stmt<'_>) {
30-
if let hir::StmtKind::Local(loc) = stmt.kind
30+
if let hir::StmtKind::Let(loc) = stmt.kind
3131
&& let hir::PatKind::Binding(ba, _, _, _) = loc.pat.kind
3232
&& matches!(ba.0, rustc_ast::ByRef::Yes)
3333
&& let Some(init) = loc.init

compiler/rustc_hir_analysis/src/check/region.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
123123

124124
for (i, statement) in blk.stmts.iter().enumerate() {
125125
match statement.kind {
126-
hir::StmtKind::Local(hir::Local { els: Some(els), .. }) => {
126+
hir::StmtKind::Let(hir::Local { els: Some(els), .. }) => {
127127
// Let-else has a special lexical structure for variables.
128128
// First we take a checkpoint of the current scope context here.
129129
let mut prev_cx = visitor.cx;
@@ -146,7 +146,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
146146
// From now on, we continue normally.
147147
visitor.cx = prev_cx;
148148
}
149-
hir::StmtKind::Local(..) => {
149+
hir::StmtKind::Let(..) => {
150150
// Each declaration introduces a subscope for bindings
151151
// introduced by the declaration; this subscope covers a
152152
// suffix of the block. Each subscope in a block has the

compiler/rustc_hir_pretty/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ impl<'a> State<'a> {
863863
fn print_stmt(&mut self, st: &hir::Stmt<'_>) {
864864
self.maybe_print_comment(st.span.lo());
865865
match st.kind {
866-
hir::StmtKind::Local(loc) => {
866+
hir::StmtKind::Let(loc) => {
867867
self.print_local(loc.init, loc.els, |this| this.print_local_decl(loc));
868868
}
869869
hir::StmtKind::Item(item) => self.ann.nested(self, Nested::Item(item)),
@@ -2306,7 +2306,7 @@ fn expr_requires_semi_to_be_stmt(e: &hir::Expr<'_>) -> bool {
23062306
/// seen the semicolon, and thus don't need another.
23072307
fn stmt_ends_with_semi(stmt: &hir::StmtKind<'_>) -> bool {
23082308
match *stmt {
2309-
hir::StmtKind::Local(_) => true,
2309+
hir::StmtKind::Let(_) => true,
23102310
hir::StmtKind::Item(_) => false,
23112311
hir::StmtKind::Expr(e) => expr_requires_semi_to_be_stmt(e),
23122312
hir::StmtKind::Semi(..) => false,

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,11 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
371371

372372
fn walk_stmt(&mut self, stmt: &hir::Stmt<'_>) {
373373
match stmt.kind {
374-
hir::StmtKind::Local(hir::Local { pat, init: Some(expr), els, .. }) => {
374+
hir::StmtKind::Let(hir::Local { pat, init: Some(expr), els, .. }) => {
375375
self.walk_local(expr, pat, *els, |_| {})
376376
}
377377

378-
hir::StmtKind::Local(_) => {}
378+
hir::StmtKind::Let(_) => {}
379379

380380
hir::StmtKind::Item(_) => {
381381
// We don't visit nested items in this visitor,

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1593,7 +1593,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15931593
// Don't do all the complex logic below for `DeclItem`.
15941594
match stmt.kind {
15951595
hir::StmtKind::Item(..) => return,
1596-
hir::StmtKind::Local(..) | hir::StmtKind::Expr(..) | hir::StmtKind::Semi(..) => {}
1596+
hir::StmtKind::Let(..) | hir::StmtKind::Expr(..) | hir::StmtKind::Semi(..) => {}
15971597
}
15981598

15991599
self.warn_if_unreachable(stmt.hir_id, stmt.span, "statement");
@@ -1602,7 +1602,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16021602
let old_diverges = self.diverges.replace(Diverges::Maybe);
16031603

16041604
match stmt.kind {
1605-
hir::StmtKind::Local(l) => {
1605+
hir::StmtKind::Let(l) => {
16061606
self.check_decl_local(l);
16071607
}
16081608
// Ignore for now.
@@ -1765,7 +1765,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17651765
[
17661766
hir::Stmt {
17671767
kind:
1768-
hir::StmtKind::Local(hir::Local {
1768+
hir::StmtKind::Let(hir::Local {
17691769
source:
17701770
hir::LocalSource::AssignDesugar(_),
17711771
..

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15991599

16001600
fn is_local_statement(&self, id: hir::HirId) -> bool {
16011601
let node = self.tcx.hir_node(id);
1602-
matches!(node, Node::Stmt(Stmt { kind: StmtKind::Local(..), .. }))
1602+
matches!(node, Node::Stmt(Stmt { kind: StmtKind::Let(..), .. }))
16031603
}
16041604

16051605
/// Suggest that `&T` was cloned instead of `T` because `T` does not implement `Clone`,

compiler/rustc_hir_typeck/src/method/suggest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22212221
impl<'v> Visitor<'v> for LetVisitor {
22222222
type Result = ControlFlow<Option<&'v hir::Expr<'v>>>;
22232223
fn visit_stmt(&mut self, ex: &'v hir::Stmt<'v>) -> Self::Result {
2224-
if let hir::StmtKind::Local(&hir::Local { pat, init, .. }) = ex.kind
2224+
if let hir::StmtKind::Let(&hir::Local { pat, init, .. }) = ex.kind
22252225
&& let Binding(_, _, ident, ..) = pat.kind
22262226
&& ident.name == self.ident_name
22272227
{

compiler/rustc_hir_typeck/src/upvar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
217217
bug!();
218218
};
219219
for stmt in block.stmts {
220-
let hir::StmtKind::Local(hir::Local {
220+
let hir::StmtKind::Let(hir::Local {
221221
init: Some(init),
222222
source: hir::LocalSource::AsyncFn,
223223
pat,

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
21392139
// the same span as the error and the type is specified.
21402140
if let hir::Stmt {
21412141
kind:
2142-
hir::StmtKind::Local(hir::Local {
2142+
hir::StmtKind::Let(hir::Local {
21432143
init: Some(hir::Expr { span: init_span, .. }),
21442144
ty: Some(array_ty),
21452145
..

compiler/rustc_infer/src/infer/error_reporting/suggest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
585585
}
586586

587587
fn visit_stmt(&mut self, ex: &'v hir::Stmt<'v>) -> Self::Result {
588-
if let hir::StmtKind::Local(hir::Local {
588+
if let hir::StmtKind::Let(hir::Local {
589589
span,
590590
pat: hir::Pat { .. },
591591
ty: None,
@@ -824,7 +824,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
824824

825825
let hir = self.tcx.hir();
826826
for stmt in blk.stmts.iter().rev() {
827-
let hir::StmtKind::Local(local) = &stmt.kind else {
827+
let hir::StmtKind::Let(local) = &stmt.kind else {
828828
continue;
829829
};
830830
local.pat.walk(&mut find_compatible_candidates);

compiler/rustc_middle/src/hir/map/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ impl<'hir> Map<'hir> {
655655
| Node::ForeignItem(_)
656656
| Node::TraitItem(_)
657657
| Node::ImplItem(_)
658-
| Node::Stmt(Stmt { kind: StmtKind::Local(_), .. }) => break,
658+
| Node::Stmt(Stmt { kind: StmtKind::Let(_), .. }) => break,
659659
Node::Expr(expr @ Expr { kind: ExprKind::If(..) | ExprKind::Match(..), .. }) => {
660660
return Some(expr);
661661
}

compiler/rustc_mir_build/src/thir/cx/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<'tcx> Cx<'tcx> {
6363
// ignore for purposes of the MIR
6464
None
6565
}
66-
hir::StmtKind::Local(local) => {
66+
hir::StmtKind::Let(local) => {
6767
let remainder_scope = region::Scope {
6868
id: block_id,
6969
data: region::ScopeData::Remainder(region::FirstStatementIndex::new(

compiler/rustc_passes/src/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2444,7 +2444,7 @@ impl<'tcx> Visitor<'tcx> for CheckAttrVisitor<'tcx> {
24442444

24452445
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
24462446
// When checking statements ignore expressions, they will be checked later.
2447-
if let hir::StmtKind::Local(l) = stmt.kind {
2447+
if let hir::StmtKind::Let(l) = stmt.kind {
24482448
self.check_attributes(l.hir_id, stmt.span, Target::Statement, None);
24492449
}
24502450
intravisit::walk_stmt(self, stmt)

compiler/rustc_passes/src/hir_stats.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
277277
fn visit_stmt(&mut self, s: &'v hir::Stmt<'v>) {
278278
record_variants!(
279279
(self, s, s.kind, Id::Node(s.hir_id), hir, Stmt, StmtKind),
280-
[Local, Item, Expr, Semi]
280+
[Let, Item, Expr, Semi]
281281
);
282282
hir_visit::walk_stmt(self, s)
283283
}

compiler/rustc_passes/src/liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
771771

772772
fn propagate_through_stmt(&mut self, stmt: &hir::Stmt<'_>, succ: LiveNode) -> LiveNode {
773773
match stmt.kind {
774-
hir::StmtKind::Local(local) => {
774+
hir::StmtKind::Let(local) => {
775775
// Note: we mark the variable as defined regardless of whether
776776
// there is an initializer. Initially I had thought to only mark
777777
// the live variable as defined if it was initialized, and then we

compiler/rustc_passes/src/naked_functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'tcx> Visitor<'tcx> for CheckInlineAssembly<'tcx> {
280280
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
281281
match stmt.kind {
282282
StmtKind::Item(..) => {}
283-
StmtKind::Local(..) => {
283+
StmtKind::Let(..) => {
284284
self.items.push((ItemKind::NonAsm, stmt.span));
285285
}
286286
StmtKind::Expr(expr) | StmtKind::Semi(expr) => {

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
763763

764764
let hir_id = self.tcx.local_def_id_to_hir_id(def_id.as_local()?);
765765
match self.tcx.parent_hir_node(hir_id) {
766-
hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Local(local), .. }) => {
766+
hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Let(local), .. }) => {
767767
get_name(err, &local.pat.kind)
768768
}
769769
// Different to previous arm because one is `&hir::Local` and the other

src/tools/clippy/clippy_lints/src/attrs/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn is_relevant_block(cx: &LateContext<'_>, typeck_results: &ty::TypeckResults<'_
5252
.as_ref()
5353
.map_or(false, |e| is_relevant_expr(cx, typeck_results, e)),
5454
|stmt| match &stmt.kind {
55-
StmtKind::Local(_) => true,
55+
StmtKind::Let(_) => true,
5656
StmtKind::Expr(expr) | StmtKind::Semi(expr) => is_relevant_expr(cx, typeck_results, expr),
5757
StmtKind::Item(_) => false,
5858
},

src/tools/clippy/clippy_lints/src/copies.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ impl BlockEq {
349349

350350
/// If the statement is a local, checks if the bound names match the expected list of names.
351351
fn eq_binding_names(s: &Stmt<'_>, names: &[(HirId, Symbol)]) -> bool {
352-
if let StmtKind::Local(l) = s.kind {
352+
if let StmtKind::Let(l) = s.kind {
353353
let mut i = 0usize;
354354
let mut res = true;
355355
l.pat.each_binding_or_first(&mut |_, _, _, name| {
@@ -389,7 +389,7 @@ fn eq_stmts(
389389
eq: &mut HirEqInterExpr<'_, '_, '_>,
390390
moved_bindings: &mut Vec<(HirId, Symbol)>,
391391
) -> bool {
392-
(if let StmtKind::Local(l) = stmt.kind {
392+
(if let StmtKind::Let(l) = stmt.kind {
393393
let old_count = moved_bindings.len();
394394
l.pat.each_binding_or_first(&mut |_, id, _, name| {
395395
moved_bindings.push((id, name.name));
@@ -432,7 +432,7 @@ fn scan_block_for_eq<'tcx>(
432432
.iter()
433433
.enumerate()
434434
.find(|&(i, stmt)| {
435-
if let StmtKind::Local(l) = stmt.kind
435+
if let StmtKind::Let(l) = stmt.kind
436436
&& needs_ordered_drop(cx, cx.typeck_results().node_type(l.hir_id))
437437
{
438438
local_needs_ordered_drop = true;
@@ -509,7 +509,7 @@ fn scan_block_for_eq<'tcx>(
509509
// Clear out all locals seen at the end so far. None of them can be moved.
510510
let stmts = &blocks[0].stmts;
511511
for stmt in &stmts[stmts.len() - init..=stmts.len() - offset] {
512-
if let StmtKind::Local(l) = stmt.kind {
512+
if let StmtKind::Let(l) = stmt.kind {
513513
l.pat.each_binding_or_first(&mut |_, id, _, _| {
514514
// FIXME(rust/#120456) - is `swap_remove` correct?
515515
eq.locals.swap_remove(&id);

src/tools/clippy/clippy_lints/src/default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
121121
// find all binding statements like `let mut _ = T::default()` where `T::default()` is the
122122
// `default` method of the `Default` trait, and store statement index in current block being
123123
// checked and the name of the bound variable
124-
let (local, variant, binding_name, binding_type, span) = if let StmtKind::Local(local) = stmt.kind
124+
let (local, variant, binding_name, binding_type, span) = if let StmtKind::Let(local) = stmt.kind
125125
// only take `let ...` statements
126126
&& let Some(expr) = local.init
127127
&& !any_parent_is_automatically_derived(cx.tcx, expr.hir_id)

src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
221221
fn visit_stmt(&mut self, stmt: &'tcx Stmt<'_>) {
222222
match stmt.kind {
223223
// we cannot check the exact type since it's a hir::Ty which does not implement `is_numeric`
224-
StmtKind::Local(local) => self.ty_bounds.push(ExplicitTyBound(local.ty.is_some())),
224+
StmtKind::Let(local) => self.ty_bounds.push(ExplicitTyBound(local.ty.is_some())),
225225

226226
_ => self.ty_bounds.push(ExplicitTyBound(false)),
227227
}

src/tools/clippy/clippy_lints/src/entry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ impl<'tcx> Visitor<'tcx> for InsertSearcher<'_, 'tcx> {
423423
}
424424
},
425425
StmtKind::Expr(e) => self.visit_expr(e),
426-
StmtKind::Local(l) => {
426+
StmtKind::Let(l) => {
427427
self.visit_pat(l.pat);
428428
if let Some(e) = l.init {
429429
self.allow_insert_closure &= !self.in_tail_pos;

src/tools/clippy/clippy_lints/src/explicit_write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitWrite {
102102
fn look_in_block<'tcx, 'hir>(cx: &LateContext<'tcx>, kind: &'tcx ExprKind<'hir>) -> &'tcx ExprKind<'hir> {
103103
if let ExprKind::Block(block, _label @ None) = kind
104104
&& let Block {
105-
stmts: [Stmt { kind: StmtKind::Local(local), .. }],
105+
stmts: [Stmt { kind: StmtKind::Let(local), .. }],
106106
expr: Some(expr_end_of_block),
107107
rules: BlockCheckMode::DefaultBlock,
108108
..

src/tools/clippy/clippy_lints/src/let_if_seq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<'tcx> LateLintPass<'tcx> for LetIfSeq {
6161
let mut it = block.stmts.iter().peekable();
6262
while let Some(stmt) = it.next() {
6363
if let Some(expr) = it.peek()
64-
&& let hir::StmtKind::Local(local) = stmt.kind
64+
&& let hir::StmtKind::Let(local) = stmt.kind
6565
&& let hir::PatKind::Binding(mode, canonical_id, ident, None) = local.pat.kind
6666
&& let hir::StmtKind::Expr(if_) = expr.kind
6767
&& let hir::ExprKind::If(

src/tools/clippy/clippy_lints/src/loops/manual_memcpy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ fn get_assignments<'a, 'tcx>(
410410
stmts
411411
.iter()
412412
.filter_map(move |stmt| match stmt.kind {
413-
StmtKind::Local(..) | StmtKind::Item(..) => None,
413+
StmtKind::Let(..) | StmtKind::Item(..) => None,
414414
StmtKind::Expr(e) | StmtKind::Semi(e) => Some(e),
415415
})
416416
.chain(*expr)

src/tools/clippy/clippy_lints/src/loops/manual_while_let_some.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn is_vec_pop_unwrap(cx: &LateContext<'_>, expr: &Expr<'_>, is_empty_recv: &Expr
7272
}
7373

7474
fn check_local(cx: &LateContext<'_>, stmt: &Stmt<'_>, is_empty_recv: &Expr<'_>, loop_span: Span) {
75-
if let StmtKind::Local(local) = stmt.kind
75+
if let StmtKind::Let(local) = stmt.kind
7676
&& let Some(init) = local.init
7777
&& is_vec_pop_unwrap(cx, init, is_empty_recv)
7878
{

src/tools/clippy/clippy_lints/src/loops/never_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn stmt_to_expr<'tcx>(stmt: &Stmt<'tcx>) -> Option<(&'tcx Expr<'tcx>, Option<&'t
137137
match stmt.kind {
138138
StmtKind::Semi(e) | StmtKind::Expr(e) => Some((e, None)),
139139
// add the let...else expression (if present)
140-
StmtKind::Local(local) => local.init.map(|init| (init, local.els)),
140+
StmtKind::Let(local) => local.init.map(|init| (init, local.els)),
141141
StmtKind::Item(..) => None,
142142
}
143143
}

src/tools/clippy/clippy_lints/src/loops/while_let_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_lint::LateContext;
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::Local(&Local {
14+
if let StmtKind::Let(&Local {
1515
init: Some(e),
1616
els: None,
1717
..

0 commit comments

Comments
 (0)