Skip to content

Commit 9d6f416

Browse files
committed
Auto merge of #12527 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 443f459 + e1d15b5 commit 9d6f416

Some content is hidden

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

68 files changed

+138
-187
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.78"
3+
version = "0.1.79"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_config/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_config"
3-
version = "0.1.78"
3+
version = "0.1.79"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.78"
3+
version = "0.1.79"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

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
},

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);

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)

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
}

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;

clippy_lints/src/escape.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
7676
.hir()
7777
.get_parent_item(cx.tcx.local_def_id_to_hir_id(fn_def_id))
7878
.def_id;
79-
let parent_node = cx.tcx.opt_hir_node_by_def_id(parent_id);
8079

8180
let mut trait_self_ty = None;
82-
if let Some(Node::Item(item)) = parent_node {
81+
if let Node::Item(item) = cx.tcx.hir_node_by_def_id(parent_id) {
8382
// If the method is an impl for a trait, don't warn.
8483
if let ItemKind::Impl(Impl { of_trait: Some(_), .. }) = item.kind {
8584
return;

clippy_lints/src/exit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<'tcx> LateLintPass<'tcx> for Exit {
4646
&& let Some(def_id) = cx.qpath_res(path, path_expr.hir_id).opt_def_id()
4747
&& cx.tcx.is_diagnostic_item(sym::process_exit, def_id)
4848
&& let parent = cx.tcx.hir().get_parent_item(e.hir_id).def_id
49-
&& let Some(Node::Item(Item{kind: ItemKind::Fn(..), ..})) = cx.tcx.opt_hir_node_by_def_id(parent)
49+
&& let Node::Item(Item{kind: ItemKind::Fn(..), ..}) = cx.tcx.hir_node_by_def_id(parent)
5050
// If the next item up is a function we check if it is an entry point
5151
// and only then emit a linter warning
5252
&& !is_entrypoint_fn(cx, parent.to_def_id())

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
..

clippy_lints/src/functions/result.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn check_result_large_err<'tcx>(cx: &LateContext<'tcx>, err_ty: Ty<'tcx>, hir_ty
9292
.expect("already checked this is adt")
9393
.did()
9494
.as_local()
95-
&& let Some(hir::Node::Item(item)) = cx.tcx.opt_hir_node_by_def_id(local_def_id)
95+
&& let hir::Node::Item(item) = cx.tcx.hir_node_by_def_id(local_def_id)
9696
&& let hir::ItemKind::Enum(ref def, _) = item.kind
9797
{
9898
let variants_size = AdtVariantInfo::new(cx, *adt, subst);

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(

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)

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
{

clippy_lints/src/loops/needless_range_loop.rs

+1-1
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

+2-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
}
@@ -255,6 +255,7 @@ fn never_loop_expr<'tcx>(
255255
InlineAsmOperand::Const { .. } | InlineAsmOperand::SymFn { .. } | InlineAsmOperand::SymStatic { .. } => {
256256
NeverLoopResult::Normal
257257
},
258+
InlineAsmOperand::Label { block } => never_loop_block(cx, block, local_labels, main_loop_id),
258259
})),
259260
ExprKind::OffsetOf(_, _)
260261
| ExprKind::Yield(_, _)

clippy_lints/src/loops/utils.rs

+2-58
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use clippy_utils::ty::{has_iter_method, implements_trait};
22
use clippy_utils::{get_parent_expr, is_integer_const, path_to_local, path_to_local_id, sugg};
33
use rustc_ast::ast::{LitIntType, LitKind};
44
use rustc_errors::Applicability;
5-
use rustc_hir::intravisit::{walk_expr, walk_local, walk_pat, walk_stmt, Visitor};
6-
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, HirId, HirIdMap, Local, Mutability, Pat, PatKind, Stmt};
5+
use rustc_hir::intravisit::{walk_expr, walk_local, Visitor};
6+
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, HirId, HirIdMap, Local, Mutability, PatKind};
77
use rustc_lint::LateContext;
88
use rustc_middle::hir::nested_filter;
99
use rustc_middle::ty::{self, Ty};
@@ -253,62 +253,6 @@ fn is_conditional(expr: &Expr<'_>) -> bool {
253253
matches!(expr.kind, ExprKind::If(..) | ExprKind::Match(..))
254254
}
255255

256-
#[derive(PartialEq, Eq)]
257-
pub(super) enum Nesting {
258-
Unknown, // no nesting detected yet
259-
RuledOut, // the iterator is initialized or assigned within scope
260-
LookFurther, // no nesting detected, no further walk required
261-
}
262-
263-
use self::Nesting::{LookFurther, RuledOut, Unknown};
264-
265-
pub(super) struct LoopNestVisitor {
266-
pub(super) hir_id: HirId,
267-
pub(super) iterator: HirId,
268-
pub(super) nesting: Nesting,
269-
}
270-
271-
impl<'tcx> Visitor<'tcx> for LoopNestVisitor {
272-
fn visit_stmt(&mut self, stmt: &'tcx Stmt<'_>) {
273-
if stmt.hir_id == self.hir_id {
274-
self.nesting = LookFurther;
275-
} else if self.nesting == Unknown {
276-
walk_stmt(self, stmt);
277-
}
278-
}
279-
280-
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
281-
if self.nesting != Unknown {
282-
return;
283-
}
284-
if expr.hir_id == self.hir_id {
285-
self.nesting = LookFurther;
286-
return;
287-
}
288-
match expr.kind {
289-
ExprKind::Assign(path, _, _) | ExprKind::AssignOp(_, path, _) => {
290-
if path_to_local_id(path, self.iterator) {
291-
self.nesting = RuledOut;
292-
}
293-
},
294-
_ => walk_expr(self, expr),
295-
}
296-
}
297-
298-
fn visit_pat(&mut self, pat: &'tcx Pat<'_>) {
299-
if self.nesting != Unknown {
300-
return;
301-
}
302-
if let PatKind::Binding(_, id, ..) = pat.kind {
303-
if id == self.iterator {
304-
self.nesting = RuledOut;
305-
return;
306-
}
307-
}
308-
walk_pat(self, pat);
309-
}
310-
}
311-
312256
/// If `arg` was the argument to a `for` loop, return the "cleanest" way of writing the
313257
/// actual `Iterator` that the loop uses.
314258
pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applic_ref: &mut Applicability) -> String {

clippy_lints/src/loops/while_immutable_condition.rs

+1-1
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

+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
..

clippy_lints/src/macro_use.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ declare_clippy_lint! {
3030
"#[macro_use] is no longer needed"
3131
}
3232

33-
#[derive(Clone, Debug, PartialEq, Eq)]
34-
struct PathAndSpan {
35-
path: String,
36-
span: Span,
37-
}
38-
39-
/// `MacroRefData` includes the name of the macro
40-
/// and the path from `SourceMap::span_to_filename`.
33+
/// `MacroRefData` includes the name of the macro.
4134
#[derive(Debug, Clone)]
4235
pub struct MacroRefData {
4336
name: String,

clippy_lints/src/manual_let_else.rs

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+2-3
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.
@@ -225,10 +225,9 @@ impl<'tcx> LateLintPass<'tcx> for LintPass {
225225
if let Some(adt_def) = cx.typeck_results().expr_ty_adjusted(recv).ty_adt_def()
226226
&& let Some(field) = adt_def.all_fields().find(|field| field.name == ident.name)
227227
&& let Some(local_did) = field.did.as_local()
228-
&& let Some(hir_id) = cx.tcx.opt_local_def_id_to_hir_id(local_did)
229228
&& !cx.tcx.type_of(field.did).skip_binder().is_phantom_data()
230229
{
231-
(hir_id, ident)
230+
(cx.tcx.local_def_id_to_hir_id(local_did), ident)
232231
} else {
233232
return;
234233
}

clippy_lints/src/missing_fields_in_debug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingFieldsInDebug {
220220
&& let self_ty = cx.tcx.type_of(self_path_did).skip_binder().peel_refs()
221221
&& let Some(self_adt) = self_ty.ty_adt_def()
222222
&& let Some(self_def_id) = self_adt.did().as_local()
223-
&& let Some(Node::Item(self_item)) = cx.tcx.opt_hir_node_by_def_id(self_def_id)
223+
&& let Node::Item(self_item) = cx.tcx.hir_node_by_def_id(self_def_id)
224224
// NB: can't call cx.typeck_results() as we are not in a body
225225
&& let typeck_results = cx.tcx.typeck_body(*body_id)
226226
&& should_lint(cx, typeck_results, block)

clippy_lints/src/mixed_read_write_in_expression.rs

+2-2
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)),

0 commit comments

Comments
 (0)