Skip to content

Commit 7a45646

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 5c98848 commit 7a45646

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

0 commit comments

Comments
 (0)