@@ -255,7 +255,7 @@ pub fn in_macro(span: Span) -> bool {
255255}
256256
257257/// 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 {
259259 matches ! ( pat. kind, PatKind :: Wild )
260260}
261261
@@ -1023,8 +1023,8 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
10231023 )
10241024 }
10251025
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) )
10281028 }
10291029
10301030 match pat. kind {
@@ -1035,23 +1035,23 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
10351035 PatKind :: Path ( ref qpath) => is_enum_variant ( cx, qpath, pat. hir_id ) ,
10361036 PatKind :: Or ( pats) => {
10371037 // 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)
10391039 } ,
1040- PatKind :: Tuple ( pats, _) => are_refutable ( cx, pats. iter ( ) . map ( |pat| & * * pat ) ) ,
1040+ PatKind :: Tuple ( pats, _) => are_refutable ( cx, pats) ,
10411041 PatKind :: Struct ( ref qpath, fields, _) => {
10421042 is_enum_variant ( cx, qpath, pat. hir_id ) || are_refutable ( cx, fields. iter ( ) . map ( |field| & * field. pat ) )
10431043 } ,
10441044 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)
10461046 } ,
1047- PatKind :: Slice ( head, ref middle, tail) => {
1047+ PatKind :: Slice ( head, middle, tail) => {
10481048 match & cx. typeck_results ( ) . node_type ( pat. hir_id ) . kind ( ) {
10491049 rustc_ty:: Slice ( ..) => {
10501050 // [..] is the only irrefutable slice pattern.
10511051 !head. is_empty ( ) || middle. is_none ( ) || !tail. is_empty ( )
10521052 } ,
10531053 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 ( ) ) )
10551055 } ,
10561056 _ => {
10571057 // unreachable!()
@@ -1066,7 +1066,7 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
10661066/// the function once on the given pattern.
10671067pub fn recurse_or_patterns < ' tcx , F : FnMut ( & ' tcx Pat < ' tcx > ) > ( pat : & ' tcx Pat < ' tcx > , mut f : F ) {
10681068 if let PatKind :: Or ( pats) = pat. kind {
1069- pats. iter ( ) . copied ( ) . for_each ( f) ;
1069+ pats. iter ( ) . for_each ( f) ;
10701070 } else {
10711071 f ( pat) ;
10721072 }
0 commit comments