Skip to content

Commit e0d3439

Browse files
Rename hir::Node::Local into hir::Node::LetStmt
1 parent d318bf1 commit e0d3439

Some content is hidden

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

43 files changed

+78
-77
lines changed

compiler/rustc_ast_lowering/src/index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
303303
}
304304

305305
fn visit_local(&mut self, l: &'hir LetStmt<'hir>) {
306-
self.insert(l.span, l.hir_id, Node::Local(l));
306+
self.insert(l.span, l.hir_id, Node::LetStmt(l));
307307
self.with_parent(l.hir_id, |this| {
308308
intravisit::walk_local(this, l);
309309
})

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
800800
for (_, node) in tcx.hir().parent_iter(expr.hir_id) {
801801
let e = match node {
802802
hir::Node::Expr(e) => e,
803-
hir::Node::Local(hir::LetStmt { els: Some(els), .. }) => {
803+
hir::Node::LetStmt(hir::LetStmt { els: Some(els), .. }) => {
804804
let mut finder = BreakFinder { found_breaks: vec![], found_continues: vec![] };
805805
finder.visit_block(els);
806806
if !finder.found_breaks.is_empty() {

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
737737
&& let body = self.infcx.tcx.hir().body(body_id)
738738
&& let Some(hir_id) = (BindingFinder { span: pat_span }).visit_body(body).break_value()
739739
&& let node = self.infcx.tcx.hir_node(hir_id)
740-
&& let hir::Node::Local(hir::LetStmt {
740+
&& let hir::Node::LetStmt(hir::LetStmt {
741741
pat: hir::Pat { kind: hir::PatKind::Ref(_, _), .. },
742742
..
743743
})
@@ -1170,7 +1170,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
11701170
};
11711171

11721172
if let Some(hir_id) = hir_id
1173-
&& let hir::Node::Local(local) = self.infcx.tcx.hir_node(hir_id)
1173+
&& let hir::Node::LetStmt(local) = self.infcx.tcx.hir_node(hir_id)
11741174
{
11751175
let tables = self.infcx.tcx.typeck(def_id.as_local().unwrap());
11761176
if let Some(clone_trait) = self.infcx.tcx.lang_items().clone_trait()

compiler/rustc_hir/src/hir.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3529,7 +3529,7 @@ pub enum Node<'hir> {
35293529
PatField(&'hir PatField<'hir>),
35303530
Arm(&'hir Arm<'hir>),
35313531
Block(&'hir Block<'hir>),
3532-
Local(&'hir LetStmt<'hir>),
3532+
LetStmt(&'hir LetStmt<'hir>),
35333533
/// `Ctor` refers to the constructor of an enum variant or struct. Only tuple or unit variants
35343534
/// with synthesized constructors.
35353535
Ctor(&'hir VariantData<'hir>),
@@ -3585,7 +3585,7 @@ impl<'hir> Node<'hir> {
35853585
| Node::Ctor(..)
35863586
| Node::Pat(..)
35873587
| Node::Arm(..)
3588-
| Node::Local(..)
3588+
| Node::LetStmt(..)
35893589
| Node::Crate(..)
35903590
| Node::Ty(..)
35913591
| Node::TraitRef(..)
@@ -3757,7 +3757,7 @@ impl<'hir> Node<'hir> {
37573757
expect_pat_field, &'hir PatField<'hir>, Node::PatField(n), n;
37583758
expect_arm, &'hir Arm<'hir>, Node::Arm(n), n;
37593759
expect_block, &'hir Block<'hir>, Node::Block(n), n;
3760-
expect_let_stmt, &'hir LetStmt<'hir>, Node::Local(n), n;
3760+
expect_let_stmt, &'hir LetStmt<'hir>, Node::LetStmt(n), n;
37613761
expect_ctor, &'hir VariantData<'hir>, Node::Ctor(n), n;
37623762
expect_lifetime, &'hir Lifetime, Node::Lifetime(n), n;
37633763
expect_generic_param, &'hir GenericParam<'hir>, Node::GenericParam(n), n;

compiler/rustc_hir_pretty/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'a> State<'a> {
113113
// `hir_map` to reconstruct their full structure for pretty
114114
// printing.
115115
Node::Ctor(..) => panic!("cannot print isolated Ctor"),
116-
Node::Local(a) => self.print_local_decl(a),
116+
Node::LetStmt(a) => self.print_local_decl(a),
117117
Node::Crate(..) => panic!("cannot print Crate"),
118118
Node::WhereBoundPredicate(pred) => {
119119
self.print_formal_generic_params(pred.bound_generic_params);

compiler/rustc_hir_typeck/src/_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
408408
}
409409
}
410410
}
411-
if let hir::Node::Local(hir::LetStmt { ty: Some(_), pat, .. }) = node {
411+
if let hir::Node::LetStmt(hir::LetStmt { ty: Some(_), pat, .. }) = node {
412412
return Some((pat.span, "expected because of this assignment".to_string()));
413413
}
414414
None

compiler/rustc_hir_typeck/src/demand.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
299299
return false;
300300
};
301301
let (init_ty_hir_id, init) = match self.tcx.parent_hir_node(pat.hir_id) {
302-
hir::Node::Local(hir::LetStmt { ty: Some(ty), init, .. }) => (ty.hir_id, *init),
303-
hir::Node::Local(hir::LetStmt { init: Some(init), .. }) => (init.hir_id, Some(*init)),
302+
hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), init, .. }) => (ty.hir_id, *init),
303+
hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) => (init.hir_id, Some(*init)),
304304
_ => return false,
305305
};
306306
let Some(init_ty) = self.node_ty_opt(init_ty_hir_id) else {
@@ -678,7 +678,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
678678
error: Option<TypeError<'tcx>>,
679679
) {
680680
match (self.tcx.parent_hir_node(expr.hir_id), error) {
681-
(hir::Node::Local(hir::LetStmt { ty: Some(ty), init: Some(init), .. }), _)
681+
(hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), init: Some(init), .. }), _)
682682
if init.hir_id == expr.hir_id =>
683683
{
684684
// Point at `let` assignment type.
@@ -724,11 +724,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
724724
primary_span = pat.span;
725725
secondary_span = pat.span;
726726
match self.tcx.parent_hir_node(pat.hir_id) {
727-
hir::Node::Local(hir::LetStmt { ty: Some(ty), .. }) => {
727+
hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), .. }) => {
728728
primary_span = ty.span;
729729
post_message = " type";
730730
}
731-
hir::Node::Local(hir::LetStmt { init: Some(init), .. }) => {
731+
hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) => {
732732
primary_span = init.span;
733733
post_message = " value";
734734
}

compiler/rustc_hir_typeck/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14521452
});
14531453
let Some((
14541454
_,
1455-
hir::Node::Local(hir::LetStmt { ty: Some(ty), .. })
1455+
hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), .. })
14561456
| hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _, _), .. }),
14571457
)) = parent_node
14581458
else {

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
318318
);
319319
expr_id = parent_id;
320320
}
321-
Node::Local(local) => {
321+
Node::LetStmt(local) => {
322322
if let Some(mut ty) = local.ty {
323323
while let Some(index) = tuple_indexes.pop() {
324324
match ty.kind {
@@ -1331,7 +1331,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13311331
// ++++++++++
13321332
// since the user probably just misunderstood how `let else`
13331333
// and `&&` work together.
1334-
if let Some((_, hir::Node::Local(local))) = cond_parent
1334+
if let Some((_, hir::Node::LetStmt(local))) = cond_parent
13351335
&& let hir::PatKind::Path(qpath) | hir::PatKind::TupleStruct(qpath, _, _) =
13361336
&local.pat.kind
13371337
&& let hir::QPath::Resolved(None, path) = qpath
@@ -1731,7 +1731,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17311731

17321732
match self.tcx.parent_hir_node(*hir_id) {
17331733
// foo.clone()
1734-
hir::Node::Local(hir::LetStmt { init: Some(init), .. }) => {
1734+
hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) => {
17351735
self.note_type_is_not_clone_inner_expr(init)
17361736
}
17371737
// When `expr` is more complex like a tuple
@@ -1740,7 +1740,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17401740
kind: hir::PatKind::Tuple(pats, ..),
17411741
..
17421742
}) => {
1743-
let hir::Node::Local(hir::LetStmt { init: Some(init), .. }) =
1743+
let hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) =
17441744
self.tcx.parent_hir_node(*pat_hir_id)
17451745
else {
17461746
return expr;
@@ -1774,7 +1774,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17741774
&& let hir::Path { segments: [_], res: crate::Res::Local(binding), .. } =
17751775
call_expr_path
17761776
&& let hir::Node::Pat(hir::Pat { hir_id, .. }) = self.tcx.hir_node(*binding)
1777-
&& let hir::Node::Local(hir::LetStmt { init: Some(init), .. }) =
1777+
&& let hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) =
17781778
self.tcx.parent_hir_node(*hir_id)
17791779
&& let Expr {
17801780
kind: hir::ExprKind::Closure(hir::Closure { body: body_id, .. }),
@@ -3134,7 +3134,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
31343134
let hir::Node::Pat(pat) = self.tcx.hir_node(hir_id) else {
31353135
return;
31363136
};
3137-
let hir::Node::Local(hir::LetStmt { ty: None, init: Some(init), .. }) =
3137+
let hir::Node::LetStmt(hir::LetStmt { ty: None, init: Some(init), .. }) =
31383138
self.tcx.parent_hir_node(pat.hir_id)
31393139
else {
31403140
return;

compiler/rustc_hir_typeck/src/method/suggest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21662166
match (filename, parent_node) {
21672167
(
21682168
FileName::Real(_),
2169-
Node::Local(hir::LetStmt {
2169+
Node::LetStmt(hir::LetStmt {
21702170
source: hir::LocalSource::Normal,
21712171
ty,
21722172
..

compiler/rustc_hir_typeck/src/pat.rs

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

745745
let ident_kind = match binding_parent {
746746
hir::Node::Param(_) => "parameter",
747-
hir::Node::Local(_) => "variable",
747+
hir::Node::LetStmt(_) => "variable",
748748
hir::Node::Arm(_) => "binding",
749749

750750
// Provide diagnostics only if the parent pattern is struct-like,

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
321321
&& let Some(expr) = block.expr
322322
&& let hir::ExprKind::Path(QPath::Resolved(_, Path { res, .. })) = expr.kind
323323
&& let Res::Local(local) = res
324-
&& let Node::Local(LetStmt { init: Some(init), .. }) = self.tcx.parent_hir_node(*local)
324+
&& let Node::LetStmt(LetStmt { init: Some(init), .. }) =
325+
self.tcx.parent_hir_node(*local)
325326
{
326327
fn collect_blocks<'hir>(expr: &hir::Expr<'hir>, blocks: &mut Vec<&hir::Block<'hir>>) {
327328
match expr.kind {

compiler/rustc_lint/src/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ impl<'tcx> LateContext<'tcx> {
937937
}
938938
&& let Some(init) = match parent_node {
939939
hir::Node::Expr(expr) => Some(expr),
940-
hir::Node::Local(hir::LetStmt { init, .. }) => *init,
940+
hir::Node::LetStmt(hir::LetStmt { init, .. }) => *init,
941941
_ => None,
942942
}
943943
{
@@ -982,7 +982,7 @@ impl<'tcx> LateContext<'tcx> {
982982
}
983983
&& let Some(init) = match parent_node {
984984
hir::Node::Expr(expr) => Some(expr),
985-
hir::Node::Local(hir::LetStmt { init, .. }) => *init,
985+
hir::Node::LetStmt(hir::LetStmt { init, .. }) => *init,
986986
hir::Node::Item(item) => match item.kind {
987987
hir::ItemKind::Const(.., body_id) | hir::ItemKind::Static(.., body_id) => {
988988
Some(self.tcx.hir().body(body_id).value)

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ impl<'hir> Map<'hir> {
567567
}
568568
// Ignore `return`s on the first iteration
569569
Node::Expr(Expr { kind: ExprKind::Loop(..) | ExprKind::Ret(..), .. })
570-
| Node::Local(_) => {
570+
| Node::LetStmt(_) => {
571571
return None;
572572
}
573573
_ => {}
@@ -906,7 +906,7 @@ impl<'hir> Map<'hir> {
906906
Node::Lifetime(lifetime) => lifetime.ident.span,
907907
Node::GenericParam(param) => param.span,
908908
Node::Infer(i) => i.span,
909-
Node::Local(local) => local.span,
909+
Node::LetStmt(local) => local.span,
910910
Node::Crate(item) => item.spans.inner_span,
911911
Node::WhereBoundPredicate(pred) => pred.span,
912912
Node::ArrayLenInfer(inf) => inf.span,
@@ -1163,7 +1163,7 @@ fn hir_id_to_string(map: Map<'_>, id: HirId) -> String {
11631163
Node::Arm(_) => node_str("arm"),
11641164
Node::Block(_) => node_str("block"),
11651165
Node::Infer(_) => node_str("infer"),
1166-
Node::Local(_) => node_str("local"),
1166+
Node::LetStmt(_) => node_str("local"),
11671167
Node::Ctor(ctor) => format!(
11681168
"{id} (ctor {})",
11691169
ctor.ctor_def_id().map_or("<missing path>".into(), |def_id| path_str(def_id)),

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
768768
}
769769
// Different to previous arm because one is `&hir::Local` and the other
770770
// is `P<hir::Local>`.
771-
hir::Node::Local(local) => get_name(err, &local.pat.kind),
771+
hir::Node::LetStmt(local) => get_name(err, &local.pat.kind),
772772
_ => None,
773773
}
774774
}
@@ -930,7 +930,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
930930
let hir::Node::Pat(pat) = self.tcx.hir_node(hir_id) else {
931931
return;
932932
};
933-
let hir::Node::Local(hir::LetStmt { ty: None, init: Some(init), .. }) =
933+
let hir::Node::LetStmt(hir::LetStmt { ty: None, init: Some(init), .. }) =
934934
self.tcx.parent_hir_node(pat.hir_id)
935935
else {
936936
return;
@@ -1562,7 +1562,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
15621562
if let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind
15631563
&& let Res::Local(hir_id) = path.res
15641564
&& let hir::Node::Pat(binding) = self.tcx.hir_node(hir_id)
1565-
&& let hir::Node::Local(local) = self.tcx.parent_hir_node(binding.hir_id)
1565+
&& let hir::Node::LetStmt(local) = self.tcx.parent_hir_node(binding.hir_id)
15661566
&& let None = local.ty
15671567
&& let Some(binding_expr) = local.init
15681568
{
@@ -2966,7 +2966,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
29662966
err.downgrade_to_delayed_bug();
29672967
}
29682968
match tcx.parent_hir_node(hir_id) {
2969-
Node::Local(hir::LetStmt { ty: Some(ty), .. }) => {
2969+
Node::LetStmt(hir::LetStmt { ty: Some(ty), .. }) => {
29702970
err.span_suggestion_verbose(
29712971
ty.span.shrink_to_lo(),
29722972
"consider borrowing here",
@@ -2975,7 +2975,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
29752975
);
29762976
err.note("all local variables must have a statically known size");
29772977
}
2978-
Node::Local(hir::LetStmt {
2978+
Node::LetStmt(hir::LetStmt {
29792979
init: Some(hir::Expr { kind: hir::ExprKind::Index(..), span, .. }),
29802980
..
29812981
}) => {
@@ -3867,7 +3867,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
38673867
if let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind
38683868
&& let hir::Path { res: Res::Local(hir_id), .. } = path
38693869
&& let hir::Node::Pat(binding) = self.tcx.hir_node(*hir_id)
3870-
&& let hir::Node::Local(local) = self.tcx.parent_hir_node(binding.hir_id)
3870+
&& let hir::Node::LetStmt(local) = self.tcx.parent_hir_node(binding.hir_id)
38713871
&& let Some(binding_expr) = local.init
38723872
{
38733873
// If the expression we're calling on is a binding, we want to point at the
@@ -4128,7 +4128,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
41284128
{
41294129
let parent = self.tcx.parent_hir_node(binding.hir_id);
41304130
// We've reached the root of the method call chain...
4131-
if let hir::Node::Local(local) = parent
4131+
if let hir::Node::LetStmt(local) = parent
41324132
&& let Some(binding_expr) = local.init
41334133
{
41344134
// ...and it is a binding. Get the binding creation and continue the chain.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
12721272
{
12731273
let parent = self.tcx.parent_hir_node(binding.hir_id);
12741274
// We've reached the root of the method call chain...
1275-
if let hir::Node::Local(local) = parent
1275+
if let hir::Node::LetStmt(local) = parent
12761276
&& let Some(binding_expr) = local.init
12771277
{
12781278
// ...and it is a binding. Get the binding creation and continue the chain.

src/tools/clippy/clippy_lints/src/assigning_clones.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ fn is_ok_to_suggest<'tcx>(cx: &LateContext<'tcx>, lhs: &Expr<'tcx>, call: &CallC
163163
// TODO: This check currently bails if the local variable has no initializer.
164164
// That is overly conservative - the lint should fire even if there was no initializer,
165165
// but the variable has been initialized before `lhs` was evaluated.
166-
if let Some(Node::Local(local)) = cx.tcx.hir().parent_id_iter(local).next().map(|p| cx.tcx.hir_node(p))
166+
if let Some(Node::LetStmt(local)) = cx.tcx.hir().parent_id_iter(local).next().map(|p| cx.tcx.hir_node(p))
167167
&& local.init.is_none()
168168
{
169169
return false;

src/tools/clippy/clippy_lints/src/box_default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -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(LetStmt { ty: Some(ty), .. }) => {
142+
Node::LetStmt(LetStmt { ty: Some(ty), .. }) => {
143143
let mut v = InferVisitor::default();
144144
v.visit_ty(ty);
145145
!v.0

src/tools/clippy/clippy_lints/src/casts/ref_as_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(super) fn check<'tcx>(
2424
&& let ty::RawPtr(TypeAndMut { mutbl: to_mutbl, .. }) = cast_to.kind()
2525
&& let Some(use_cx) = expr_use_ctxt(cx, expr)
2626
// TODO: only block the lint if `cast_expr` is a temporary
27-
&& !matches!(use_cx.node, ExprUseNode::Local(_) | ExprUseNode::ConstStatic(_))
27+
&& !matches!(use_cx.node, ExprUseNode::LetStmt(_) | ExprUseNode::ConstStatic(_))
2828
{
2929
let core_or_std = if is_no_std_crate(cx) { "core" } else { "std" };
3030
let fn_name = match to_mutbl {

src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub(super) fn check<'tcx>(
6666
&& let QPath::Resolved(None, Path { res, .. }) = qpath
6767
&& let Res::Local(hir_id) = res
6868
&& let parent = cx.tcx.parent_hir_node(*hir_id)
69-
&& let Node::Local(local) = parent
69+
&& let Node::LetStmt(local) = parent
7070
{
7171
if let Some(ty) = local.ty
7272
&& let TyKind::Path(qpath) = ty.kind
@@ -275,7 +275,7 @@ fn is_cast_from_ty_alias<'tcx>(cx: &LateContext<'tcx>, expr: impl Visitable<'tcx
275275
}
276276
// Local usage
277277
} else if let Res::Local(hir_id) = res
278-
&& let Node::Local(l) = cx.tcx.parent_hir_node(hir_id)
278+
&& let Node::LetStmt(l) = cx.tcx.parent_hir_node(hir_id)
279279
{
280280
if let Some(e) = l.init
281281
&& is_cast_from_ty_alias(cx, e, cast_from)

src/tools/clippy/clippy_lints/src/ignored_unit_patterns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<'tcx> LateLintPass<'tcx> for IgnoredUnitPatterns {
4646
// Ignore function parameters
4747
return;
4848
},
49-
Node::Local(local) if local.ty.is_some() => {
49+
Node::LetStmt(local) if local.ty.is_some() => {
5050
// Ignore let bindings with explicit type
5151
return;
5252
},

0 commit comments

Comments
 (0)