Skip to content

Commit c1cfb3a

Browse files
committed
use more destructuring in redundant_locals
1 parent 58581eb commit c1cfb3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/redundant_locals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ impl<'tcx> LateLintPass<'tcx> for RedundantLocals {
5050
if let Some(expr) = local.init;
5151
if let ExprKind::Path(qpath @ QPath::Resolved(None, path)) = expr.kind;
5252
// 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;
53+
if let [last_segment] = path.segments;
54+
if last_segment.ident == ident;
5555
// resolve the path to its defining binding pattern
5656
if let Res::Local(binding_id) = cx.qpath_res(&qpath, expr.hir_id);
5757
if let Node::Pat(binding_pat) = cx.tcx.hir().get(binding_id);

0 commit comments

Comments
 (0)