pub fn necessary_variants(dm: &DefMap, pat: &hir::Pat) -> Vec<DefId> {
    let mut variants = vec![];
    pat.walk(|p| {
        match p.node {
            PatKind::TupleStruct(..) |
            PatKind::Path(..) |
            PatKind::Struct(..) => {
                match dm.get(&p.id).map(|d| d.full_def()) {
                    Some(Def::Variant(id)) |
                    Some(Def::VariantCtor(id, ..)) => variants.push(id),
                    _ => ()
                }
            }
            _ => ()
        }
        true
    });
    variants.sort();
    variants.dedup();
    variants
}
/// Return variants that are necessary to exist for the pattern to match.
Return variants that are necessary to exist for the pattern to match.
Return variants that are necessary to exist for the pattern to match .
pub fn necessary_variants(dm: &DefMap, pat: &hir::Pat) -> Vec<DefId> {
    let mut variants = vec![];
    pat.walk(|p| {
        match p.node {
            PatKind::TupleStruct(..) |
            PatKind::Path(..) |
            PatKind::Struct(..) => {
                match dm.get(&p.id).map(|d| d.full_def()) {
                    Some(Def::Variant(id)) |
                    Some(Def::VariantCtor(id, ..)) => variants.push(id),
                    _ => ()
                }
            }
            _ => ()
        }
        true
    });
    variants.sort();
    variants.dedup();
    variants
}
pub fn necessary_variants ( dm : & DefMap , pat : & hir :: Pat ) -> Vec < DefId > { let mut variants = vec ! [ ] ; pat . walk ( | p | { match p . node { PatKind :: TupleStruct ( .. ) | PatKind :: Path ( .. ) | PatKind :: Struct ( .. ) => { match dm . get ( & p . id ) . map ( | d | d . full_def ( ) ) { Some ( Def :: Variant ( id ) ) | Some ( Def :: VariantCtor ( id , .. ) ) => variants . push ( id ) , _ => ( ) } } _ => ( ) } true } ) ; variants . sort ( ) ; variants . dedup ( ) ; variants }
Return variants that are necessary to exist for the pattern to match.
Return variants that are necessary to exist for the pattern to match .
dm
&DefMap
pat
&hir::Pat
dm
&DefMap
pat
&hir::Pat