Skip to content

Commit c27aa1b

Browse files
committed
misc: use None in the pattern directly
this'll probably be marginally faster thanks to the equality check being now structural
1 parent 1270bea commit c27aa1b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

clippy_utils/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,9 +1977,7 @@ pub fn is_expr_identity_of_pat(cx: &LateContext<'_>, pat: &Pat<'_>, expr: &Expr<
19771977
{
19781978
zip(pats, tup).all(|(pat, expr)| is_expr_identity_of_pat(cx, pat, expr, by_hir))
19791979
},
1980-
(PatKind::Slice(before, slice, after), ExprKind::Array(arr))
1981-
if slice.is_none() && before.len() + after.len() == arr.len() =>
1982-
{
1980+
(PatKind::Slice(before, None, after), ExprKind::Array(arr)) if before.len() + after.len() == arr.len() => {
19831981
zip(before.iter().chain(after), arr).all(|(pat, expr)| is_expr_identity_of_pat(cx, pat, expr, by_hir))
19841982
},
19851983
(PatKind::TupleStruct(pat_ident, field_pats, dotdot), ExprKind::Call(ident, fields))

0 commit comments

Comments
 (0)