Skip to content

Commit 22577e5

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents 25fb1f0 + 0e2897f commit 22577e5

40 files changed

+52
-52
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/needless_range_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
273273
}
274274
return false; // no need to walk further *on the variable*
275275
},
276-
Res::Def(DefKind::Static(_) | DefKind::Const, ..) => {
276+
Res::Def(DefKind::Static{..} | DefKind::Const, ..) => {
277277
if index_used_directly {
278278
self.indexed_directly.insert(
279279
seqvar.segments[0].ident.name,

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
}

clippy_lints/src/loops/while_immutable_condition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
101101
Res::Local(hir_id) => {
102102
self.ids.insert(hir_id);
103103
},
104-
Res::Def(DefKind::Static(_), def_id) => {
104+
Res::Def(DefKind::Static{..}, def_id) => {
105105
let mutable = self.cx.tcx.is_mutable_static(def_id);
106106
self.def_ids.insert(def_id, mutable);
107107
},

clippy_lints/src/loops/while_let_loop.rs

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

clippy_lints/src/manual_let_else.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'tcx> QuestionMark {
5353
return;
5454
}
5555

56-
if let StmtKind::Local(local) = stmt.kind
56+
if let StmtKind::Let(local) = stmt.kind
5757
&& let Some(init) = local.init
5858
&& local.els.is_none()
5959
&& local.ty.is_none()

clippy_lints/src/map_unit_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn reduce_unit_expression(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> Option<
138138
// If block only contains statements,
139139
// reduce `{ X; }` to `X` or `X;`
140140
match inner_stmt.kind {
141-
hir::StmtKind::Local(local) => Some(local.span),
141+
hir::StmtKind::Let(local) => Some(local.span),
142142
hir::StmtKind::Expr(e) => Some(e.span),
143143
hir::StmtKind::Semi(..) => Some(inner_stmt.span),
144144
hir::StmtKind::Item(..) => None,

clippy_lints/src/methods/expect_fun_call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub(super) fn check<'tcx>(
9191
},
9292
hir::ExprKind::Path(ref p) => matches!(
9393
cx.qpath_res(p, arg.hir_id),
94-
hir::def::Res::Def(hir::def::DefKind::Const | hir::def::DefKind::Static(_), _)
94+
hir::def::Res::Def(hir::def::DefKind::Const | hir::def::DefKind::Static{..}, _)
9595
),
9696
_ => false,
9797
}

clippy_lints/src/methods/needless_collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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::Local(Local { init, pat, .. }) => {
427+
StmtKind::Let(Local { 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ fn indirect_usage<'tcx>(
198198
binding: HirId,
199199
ctxt: SyntaxContext,
200200
) -> Option<IndirectUsage<'tcx>> {
201-
if let StmtKind::Local(&Local {
201+
if let StmtKind::Let(&Local {
202202
pat: Pat {
203203
kind: PatKind::Binding(BindingAnnotation::NONE, _, ident, None),
204204
..

clippy_lints/src/methods/unnecessary_result_map_or_else.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn emit_lint(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, def_arg: &E
2727

2828
fn get_last_chain_binding_hir_id(mut hir_id: HirId, statements: &[Stmt<'_>]) -> Option<HirId> {
2929
for stmt in statements {
30-
if let StmtKind::Local(local) = stmt.kind
30+
if let StmtKind::Let(local) = stmt.kind
3131
&& let Some(init) = local.init
3232
&& let ExprKind::Path(QPath::Resolved(_, path)) = init.kind
3333
&& let hir::def::Res::Local(local_hir_id) = path.res

clippy_lints/src/misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'tcx> LateLintPass<'tcx> for LintPass {
143143

144144
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
145145
if !in_external_macro(cx.tcx.sess, stmt.span)
146-
&& let StmtKind::Local(local) = stmt.kind
146+
&& let StmtKind::Let(local) = stmt.kind
147147
&& let PatKind::Binding(BindingAnnotation(ByRef::Yes, mutabl), .., name, None) = local.pat.kind
148148
&& let Some(init) = local.init
149149
// Do not emit if clippy::ref_patterns is not allowed to avoid having two lints for the same issue.

clippy_lints/src/mixed_read_write_in_expression.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<'tcx> LateLintPass<'tcx> for EvalOrderDependence {
9797
}
9898
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
9999
match stmt.kind {
100-
StmtKind::Local(local) => {
100+
StmtKind::Let(local) => {
101101
if let Local { init: Some(e), .. } = local {
102102
DivergenceVisitor { cx }.visit_expr(e);
103103
}
@@ -291,7 +291,7 @@ fn check_stmt<'tcx>(vis: &mut ReadVisitor<'_, 'tcx>, stmt: &'tcx Stmt<'_>) -> St
291291
StmtKind::Expr(expr) | StmtKind::Semi(expr) => check_expr(vis, expr),
292292
// If the declaration is of a local variable, check its initializer
293293
// expression if it has one. Otherwise, keep going.
294-
StmtKind::Local(local) => local
294+
StmtKind::Let(local) => local
295295
.init
296296
.as_ref()
297297
.map_or(StopEarly::KeepGoing, |expr| check_expr(vis, expr)),

clippy_lints/src/multiple_unsafe_ops_per_block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn collect_unsafe_exprs<'tcx>(
109109
ExprKind::Path(QPath::Resolved(
110110
_,
111111
hir::Path {
112-
res: Res::Def(DefKind::Static(Mutability::Mut), _),
112+
res: Res::Def(DefKind::Static{mutability:Mutability::Mut, ..}, _),
113113
..
114114
},
115115
)) => {
@@ -149,7 +149,7 @@ fn collect_unsafe_exprs<'tcx>(
149149
ExprKind::Path(QPath::Resolved(
150150
_,
151151
hir::Path {
152-
res: Res::Def(DefKind::Static(Mutability::Mut), _),
152+
res: Res::Def(DefKind::Static{mutability:Mutability::Mut, ..}, _),
153153
..
154154
}
155155
))

clippy_lints/src/needless_late_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn contains_let(cond: &Expr<'_>) -> bool {
8686
}
8787

8888
fn stmt_needs_ordered_drop(cx: &LateContext<'_>, stmt: &Stmt<'_>) -> bool {
89-
let StmtKind::Local(local) = stmt.kind else {
89+
let StmtKind::Let(local) = stmt.kind else {
9090
return false;
9191
};
9292
!local.pat.walk_short(|pat| {

clippy_lints/src/no_effect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl NoEffect {
174174
);
175175
return true;
176176
}
177-
} else if let StmtKind::Local(local) = stmt.kind {
177+
} else if let StmtKind::Let(local) = stmt.kind {
178178
if !is_lint_allowed(cx, NO_EFFECT_UNDERSCORE_BINDING, local.hir_id)
179179
&& !matches!(local.source, LocalSource::AsyncFn)
180180
&& let Some(init) = local.init

clippy_lints/src/pattern_type_mismatch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ declare_lint_pass!(PatternTypeMismatch => [PATTERN_TYPE_MISMATCH]);
8282

8383
impl<'tcx> LateLintPass<'tcx> for PatternTypeMismatch {
8484
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
85-
if let StmtKind::Local(local) = stmt.kind {
85+
if let StmtKind::Let(local) = stmt.kind {
8686
if in_external_macro(cx.sess(), local.pat.span) {
8787
return;
8888
}

clippy_lints/src/question_mark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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::Local(Local {
112+
if let StmtKind::Let(Local {
113113
pat,
114114
init: Some(init_expr),
115115
els: Some(els),

clippy_lints/src/read_zero_byte_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<'tcx> LateLintPass<'tcx> for ReadZeroByteVec {
5656
return;
5757
}
5858

59-
if let StmtKind::Local(local) = stmt.kind
59+
if let StmtKind::Let(local) = stmt.kind
6060
&& let Local {
6161
pat, init: Some(init), ..
6262
} = local

clippy_lints/src/redundant_closure_call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall {
262262
}
263263

264264
for w in block.stmts.windows(2) {
265-
if let hir::StmtKind::Local(local) = w[0].kind
265+
if let hir::StmtKind::Let(local) = w[0].kind
266266
&& let Option::Some(t) = local.init
267267
&& let hir::ExprKind::Closure { .. } = t.kind
268268
&& let hir::PatKind::Binding(_, _, ident, _) = local.pat.kind

clippy_lints/src/returns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl<'tcx> LateLintPass<'tcx> for Return {
222222
// we need both a let-binding stmt and an expr
223223
if let Some(retexpr) = block.expr
224224
&& let Some(stmt) = block.stmts.iter().last()
225-
&& let StmtKind::Local(local) = &stmt.kind
225+
&& let StmtKind::Let(local) = &stmt.kind
226226
&& local.ty.is_none()
227227
&& cx.tcx.hir().attrs(local.hir_id).is_empty()
228228
&& let Some(initexpr) = &local.init

clippy_lints/src/significant_drop_tightening.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl<'ap, 'lc, 'others, 'stmt, 'tcx> StmtsChecker<'ap, 'lc, 'others, 'stmt, 'tcx
236236
fn manage_has_expensive_expr_after_last_attr(&mut self) {
237237
let has_expensive_stmt = match self.ap.curr_stmt.kind {
238238
hir::StmtKind::Expr(expr) if is_inexpensive_expr(expr) => false,
239-
hir::StmtKind::Local(local)
239+
hir::StmtKind::Let(local)
240240
if let Some(expr) = local.init
241241
&& let hir::ExprKind::Path(_) = expr.kind =>
242242
{
@@ -290,7 +290,7 @@ impl<'ap, 'lc, 'others, 'stmt, 'tcx> Visitor<'tcx> for StmtsChecker<'ap, 'lc, 'o
290290
};
291291
let mut ac = AttrChecker::new(self.cx, self.seen_types, self.type_cache);
292292
if ac.has_sig_drop_attr(self.cx.typeck_results().expr_ty(expr)) {
293-
if let hir::StmtKind::Local(local) = self.ap.curr_stmt.kind
293+
if let hir::StmtKind::Let(local) = self.ap.curr_stmt.kind
294294
&& let hir::PatKind::Binding(_, hir_id, ident, _) = local.pat.kind
295295
&& !self.ap.apas.contains_key(&hir_id)
296296
&& {
@@ -326,7 +326,7 @@ impl<'ap, 'lc, 'others, 'stmt, 'tcx> Visitor<'tcx> for StmtsChecker<'ap, 'lc, 'o
326326
return;
327327
};
328328
match self.ap.curr_stmt.kind {
329-
hir::StmtKind::Local(local) => {
329+
hir::StmtKind::Let(local) => {
330330
if let hir::PatKind::Binding(_, _, ident, _) = local.pat.kind {
331331
apa.last_bind_ident = ident;
332332
}

clippy_lints/src/slow_vector_initialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<'tcx> LateLintPass<'tcx> for SlowVectorInit {
119119
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
120120
// Matches statements which initializes vectors. For example: `let mut vec = Vec::with_capacity(10)`
121121
// or `Vec::new()`
122-
if let StmtKind::Local(local) = stmt.kind
122+
if let StmtKind::Let(local) = stmt.kind
123123
&& let PatKind::Binding(BindingAnnotation::MUT, local_id, _, None) = local.pat.kind
124124
&& let Some(init) = local.init
125125
&& let Some(size_expr) = Self::as_vec_initializer(cx, init)

clippy_lints/src/swap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn check_manual_swap(cx: &LateContext<'_>, block: &Block<'_>) {
148148
}
149149

150150
for [s1, s2, s3] in block.stmts.array_windows::<3>() {
151-
if let StmtKind::Local(tmp) = s1.kind
151+
if let StmtKind::Let(tmp) = s1.kind
152152
// let t = foo();
153153
&& let Some(tmp_init) = tmp.init
154154
&& let PatKind::Binding(.., ident, None) = tmp.pat.kind
@@ -243,7 +243,7 @@ fn parse<'a, 'hir>(stmt: &'a Stmt<'hir>) -> Option<(ExprOrIdent<'hir>, &'a Expr<
243243
if let ExprKind::Assign(lhs, rhs, _) = expr.kind {
244244
return Some((ExprOrIdent::Expr(lhs), rhs));
245245
}
246-
} else if let StmtKind::Local(expr) = stmt.kind {
246+
} else if let StmtKind::Let(expr) = stmt.kind {
247247
if let Some(rhs) = expr.init {
248248
if let PatKind::Binding(_, _, ident_l, _) = expr.pat.kind {
249249
return Some((ExprOrIdent::Ident(ident_l), rhs));

clippy_lints/src/undocumented_unsafe_blocks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<'tcx> LateLintPass<'tcx> for UndocumentedUnsafeBlocks {
158158
}
159159

160160
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &hir::Stmt<'tcx>) {
161-
let (hir::StmtKind::Local(&hir::Local { init: Some(expr), .. })
161+
let (hir::StmtKind::Let(&hir::Local { init: Some(expr), .. })
162162
| hir::StmtKind::Expr(expr)
163163
| hir::StmtKind::Semi(expr)) = stmt.kind
164164
else {
@@ -358,7 +358,7 @@ fn block_parents_have_safety_comment(
358358
},
359359
Node::Stmt(hir::Stmt {
360360
kind:
361-
hir::StmtKind::Local(hir::Local { span, hir_id, .. })
361+
hir::StmtKind::Let(hir::Local { span, hir_id, .. })
362362
| hir::StmtKind::Expr(hir::Expr { span, hir_id, .. })
363363
| hir::StmtKind::Semi(hir::Expr { span, hir_id, .. }),
364364
..

clippy_lints/src/uninit_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl<'tcx> VecLocation<'tcx> {
153153
/// or `self` expression for `Vec::reserve()`.
154154
fn extract_init_or_reserve_target<'tcx>(cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'tcx>) -> Option<TargetVec<'tcx>> {
155155
match stmt.kind {
156-
StmtKind::Local(local) => {
156+
StmtKind::Let(local) => {
157157
if let Some(init_expr) = local.init
158158
&& let PatKind::Binding(_, hir_id, _, None) = local.pat.kind
159159
&& let Some(init_kind) = get_vec_init_kind(cx, init_expr)

0 commit comments

Comments
 (0)