@@ -84,7 +84,7 @@ pub use self::hir_utils::{
84
84
use core:: mem;
85
85
use core:: ops:: ControlFlow ;
86
86
use std:: collections:: hash_map:: Entry ;
87
- use std:: iter:: { once, repeat_n} ;
87
+ use std:: iter:: { once, repeat_n, zip } ;
88
88
use std:: sync:: { Mutex , MutexGuard , OnceLock } ;
89
89
90
90
use itertools:: Itertools ;
@@ -581,7 +581,7 @@ pub fn can_mut_borrow_both(cx: &LateContext<'_>, e1: &Expr<'_>, e2: &Expr<'_>) -
581
581
return false ;
582
582
}
583
583
584
- for ( x1, x2) in s1 . iter ( ) . zip ( s2 . iter ( ) ) {
584
+ for ( x1, x2) in zip ( & s1 , & s2 ) {
585
585
if expr_custom_deref_adjustment ( cx, x1) . is_some ( ) || expr_custom_deref_adjustment ( cx, x2) . is_some ( ) {
586
586
return false ;
587
587
}
@@ -1923,24 +1923,20 @@ fn is_body_identity_function(cx: &LateContext<'_>, func: &Body<'_>) -> bool {
1923
1923
( PatKind :: Tuple ( pats, dotdot) , ExprKind :: Tup ( tup) )
1924
1924
if dotdot. as_opt_usize ( ) . is_none ( ) && pats. len ( ) == tup. len ( ) =>
1925
1925
{
1926
- pats . iter ( ) . zip ( tup) . all ( |( pat, expr) | check_pat ( cx, pat, expr) )
1926
+ zip ( pats , tup) . all ( |( pat, expr) | check_pat ( cx, pat, expr) )
1927
1927
} ,
1928
1928
( PatKind :: Slice ( before, slice, after) , ExprKind :: Array ( arr) )
1929
1929
if slice. is_none ( ) && before. len ( ) + after. len ( ) == arr. len ( ) =>
1930
1930
{
1931
- ( before. iter ( ) . chain ( after) )
1932
- . zip ( arr)
1933
- . all ( |( pat, expr) | check_pat ( cx, pat, expr) )
1931
+ zip ( before. iter ( ) . chain ( after) , arr) . all ( |( pat, expr) | check_pat ( cx, pat, expr) )
1934
1932
} ,
1935
1933
( PatKind :: TupleStruct ( pat_ident, field_pats, dotdot) , ExprKind :: Call ( ident, fields) )
1936
1934
if dotdot. as_opt_usize ( ) . is_none ( )
1937
1935
&& let ExprKind :: Path ( ident) = ident. kind =>
1938
1936
{
1939
1937
field_pats. len ( ) == fields. len ( )
1940
1938
&& qpath_res ( & pat_ident, pat. hir_id ) == qpath_res ( & ident, expr. hir_id )
1941
- && ( field_pats. iter ( ) )
1942
- . zip ( fields)
1943
- . all ( |( pat, expr) | check_pat ( cx, pat, expr) )
1939
+ && zip ( field_pats, fields) . all ( |( pat, expr) | check_pat ( cx, pat, expr) )
1944
1940
} ,
1945
1941
(
1946
1942
PatKind :: Struct ( pat_ident, field_pats, false ) ,
0 commit comments