We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
redundant_locals
1 parent 58581eb commit c1cfb3aCopy full SHA for c1cfb3a
clippy_lints/src/redundant_locals.rs
@@ -50,8 +50,8 @@ impl<'tcx> LateLintPass<'tcx> for RedundantLocals {
50
if let Some(expr) = local.init;
51
if let ExprKind::Path(qpath @ QPath::Resolved(None, path)) = expr.kind;
52
// the path is a single segment equal to the local's name
53
- if path.segments.len() == 1;
54
- if path.segments[0].ident == ident;
+ if let [last_segment] = path.segments;
+ if last_segment.ident == ident;
55
// resolve the path to its defining binding pattern
56
if let Res::Local(binding_id) = cx.qpath_res(&qpath, expr.hir_id);
57
if let Node::Pat(binding_pat) = cx.tcx.hir().get(binding_id);
0 commit comments