Skip to content

Commit e7c4121

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 174d82c commit e7c4121

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
@@ -1927,9 +1927,7 @@ fn is_body_identity_function(cx: &LateContext<'_>, func: &Body<'_>) -> bool {
19271927
{
19281928
zip(pats, tup).all(|(pat, expr)| check_pat(cx, pat, expr))
19291929
},
1930-
(PatKind::Slice(before, slice, after), ExprKind::Array(arr))
1931-
if slice.is_none() && before.len() + after.len() == arr.len() =>
1932-
{
1930+
(PatKind::Slice(before, None, after), ExprKind::Array(arr)) if before.len() + after.len() == arr.len() => {
19331931
zip(before.iter().chain(after), arr).all(|(pat, expr)| check_pat(cx, pat, expr))
19341932
},
19351933
(PatKind::TupleStruct(pat_ident, field_pats, dotdot), ExprKind::Call(ident, fields))

0 commit comments

Comments
 (0)