@@ -255,7 +255,7 @@ pub fn in_macro(span: Span) -> bool {
255
255
}
256
256
257
257
/// Checks if given pattern is a wildcard (`_`)
258
- pub fn is_wild < ' tcx > ( pat : & impl std :: ops :: Deref < Target = Pat < ' tcx > > ) -> bool {
258
+ pub fn is_wild ( pat : & Pat < ' _ > ) -> bool {
259
259
matches ! ( pat. kind, PatKind :: Wild )
260
260
}
261
261
@@ -1023,8 +1023,8 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
1023
1023
)
1024
1024
}
1025
1025
1026
- fn are_refutable < ' a , I : Iterator < Item = & ' a Pat < ' a > > > ( cx : & LateContext < ' _ > , mut i : I ) -> bool {
1027
- i. any ( |pat| is_refutable ( cx, pat) )
1026
+ fn are_refutable < ' a , I : IntoIterator < Item = & ' a Pat < ' a > > > ( cx : & LateContext < ' _ > , i : I ) -> bool {
1027
+ i. into_iter ( ) . any ( |pat| is_refutable ( cx, pat) )
1028
1028
}
1029
1029
1030
1030
match pat. kind {
@@ -1035,23 +1035,23 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
1035
1035
PatKind :: Path ( ref qpath) => is_enum_variant ( cx, qpath, pat. hir_id ) ,
1036
1036
PatKind :: Or ( pats) => {
1037
1037
// TODO: should be the honest check, that pats is exhaustive set
1038
- are_refutable ( cx, pats. iter ( ) . map ( |pat| & * * pat ) )
1038
+ are_refutable ( cx, pats)
1039
1039
} ,
1040
- PatKind :: Tuple ( pats, _) => are_refutable ( cx, pats. iter ( ) . map ( |pat| & * * pat ) ) ,
1040
+ PatKind :: Tuple ( pats, _) => are_refutable ( cx, pats) ,
1041
1041
PatKind :: Struct ( ref qpath, fields, _) => {
1042
1042
is_enum_variant ( cx, qpath, pat. hir_id ) || are_refutable ( cx, fields. iter ( ) . map ( |field| & * field. pat ) )
1043
1043
} ,
1044
1044
PatKind :: TupleStruct ( ref qpath, pats, _) => {
1045
- is_enum_variant ( cx, qpath, pat. hir_id ) || are_refutable ( cx, pats. iter ( ) . map ( |pat| & * * pat ) )
1045
+ is_enum_variant ( cx, qpath, pat. hir_id ) || are_refutable ( cx, pats)
1046
1046
} ,
1047
- PatKind :: Slice ( head, ref middle, tail) => {
1047
+ PatKind :: Slice ( head, middle, tail) => {
1048
1048
match & cx. typeck_results ( ) . node_type ( pat. hir_id ) . kind ( ) {
1049
1049
rustc_ty:: Slice ( ..) => {
1050
1050
// [..] is the only irrefutable slice pattern.
1051
1051
!head. is_empty ( ) || middle. is_none ( ) || !tail. is_empty ( )
1052
1052
} ,
1053
1053
rustc_ty:: Array ( ..) => {
1054
- are_refutable ( cx, head. iter ( ) . chain ( middle) . chain ( tail. iter ( ) ) . map ( |pat| & * * pat ) )
1054
+ are_refutable ( cx, head. iter ( ) . chain ( middle) . chain ( tail. iter ( ) ) )
1055
1055
} ,
1056
1056
_ => {
1057
1057
// unreachable!()
@@ -1066,7 +1066,7 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
1066
1066
/// the function once on the given pattern.
1067
1067
pub fn recurse_or_patterns < ' tcx , F : FnMut ( & ' tcx Pat < ' tcx > ) > ( pat : & ' tcx Pat < ' tcx > , mut f : F ) {
1068
1068
if let PatKind :: Or ( pats) = pat. kind {
1069
- pats. iter ( ) . copied ( ) . for_each ( f) ;
1069
+ pats. iter ( ) . for_each ( f) ;
1070
1070
} else {
1071
1071
f ( pat) ;
1072
1072
}
0 commit comments