@@ -1565,10 +1565,10 @@ pub fn is_ctor_or_promotable_const_function(cx: &LateContext<'_>, expr: &Expr<'_
15651565/// Returns `true` if a pattern is refutable. 
15661566// TODO: should be implemented using rustc/mir_build/thir machinery 
15671567pub  fn  is_refutable ( cx :  & LateContext < ' _ > ,  pat :  & Pat < ' _ > )  -> bool  { 
1568-     fn  is_enum_variant ( cx :  & LateContext < ' _ > ,  qpath :  & QPath < ' _ > ,  id :  HirId )  -> bool  { 
1569-         matches ! ( 
1568+     fn  is_qpath_refutable ( cx :  & LateContext < ' _ > ,  qpath :  & QPath < ' _ > ,  id :  HirId )  -> bool  { 
1569+         ! matches ! ( 
15701570            cx. qpath_res( qpath,  id) , 
1571-             Res :: Def ( DefKind :: Variant ,  ..)  | Res :: Def ( DefKind :: Ctor ( def:: CtorOf :: Variant ,  _) ,  _) 
1571+             Res :: Def ( DefKind :: Struct ,  ..)  | Res :: Def ( DefKind :: Ctor ( def:: CtorOf :: Struct ,  _) ,  _) 
15721572        ) 
15731573    } 
15741574
@@ -1585,16 +1585,18 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
15851585            kind :  PatExprKind :: Path ( qpath) , 
15861586            hir_id, 
15871587            ..
1588-         } )  => is_enum_variant ( cx,  qpath,  * hir_id) , 
1588+         } )  => is_qpath_refutable ( cx,  qpath,  * hir_id) , 
15891589        PatKind :: Or ( pats)  => { 
15901590            // TODO: should be the honest check, that pats is exhaustive set 
15911591            are_refutable ( cx,  pats) 
15921592        } , 
15931593        PatKind :: Tuple ( pats,  _)  => are_refutable ( cx,  pats) , 
15941594        PatKind :: Struct ( ref  qpath,  fields,  _)  => { 
1595-             is_enum_variant ( cx,  qpath,  pat. hir_id )  || are_refutable ( cx,  fields. iter ( ) . map ( |field| field. pat ) ) 
1595+             is_qpath_refutable ( cx,  qpath,  pat. hir_id )  || are_refutable ( cx,  fields. iter ( ) . map ( |field| field. pat ) ) 
1596+         } , 
1597+         PatKind :: TupleStruct ( ref  qpath,  pats,  _)  => { 
1598+             is_qpath_refutable ( cx,  qpath,  pat. hir_id )  || are_refutable ( cx,  pats) 
15961599        } , 
1597-         PatKind :: TupleStruct ( ref  qpath,  pats,  _)  => is_enum_variant ( cx,  qpath,  pat. hir_id )  || are_refutable ( cx,  pats) , 
15981600        PatKind :: Slice ( head,  middle,  tail)  => { 
15991601            match  & cx. typeck_results ( ) . node_type ( pat. hir_id ) . kind ( )  { 
16001602                rustc_ty:: Slice ( ..)  => { 
0 commit comments