Skip to content

Commit 0e2897f

Browse files
Rename hir::StmtKind::Local into hir::StmtKind::Let
1 parent da2795f commit 0e2897f

35 files changed

+46
-46
lines changed

clippy_lints/src/attrs/utils.rs

Lines changed: 1 addition & 1 deletion
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
},

clippy_lints/src/copies.rs

Lines changed: 4 additions & 4 deletions
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);

clippy_lints/src/default.rs

Lines changed: 1 addition & 1 deletion
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)

clippy_lints/src/default_numeric_fallback.rs

Lines changed: 1 addition & 1 deletion
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
}

clippy_lints/src/entry.rs

Lines changed: 1 addition & 1 deletion
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;

clippy_lints/src/explicit_write.rs

Lines changed: 1 addition & 1 deletion
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
..

clippy_lints/src/let_if_seq.rs

Lines changed: 1 addition & 1 deletion
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(

clippy_lints/src/loops/manual_memcpy.rs

Lines changed: 1 addition & 1 deletion
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)

clippy_lints/src/loops/manual_while_let_some.rs

Lines changed: 1 addition & 1 deletion
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
{

clippy_lints/src/loops/never_loop.rs

Lines changed: 1 addition & 1 deletion
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
}

0 commit comments

Comments
 (0)