@@ -70,7 +70,6 @@ pub fn pat_is_refutable(dm: &DefMap, pat: &hir::Pat) -> bool {
7070 PatKind :: Lit ( _) | PatKind :: Range ( _, _) | PatKind :: QPath ( ..) => true ,
7171 PatKind :: TupleStruct ( ..) |
7272 PatKind :: Path ( ..) |
73- PatKind :: Ident ( _, _, None ) |
7473 PatKind :: Struct ( ..) => {
7574 match dm. get ( & pat. id ) . map ( |d| d. full_def ( ) ) {
7675 Some ( Def :: Variant ( ..) ) => true ,
@@ -86,7 +85,6 @@ pub fn pat_is_variant_or_struct(dm: &DefMap, pat: &hir::Pat) -> bool {
8685 match pat. node {
8786 PatKind :: TupleStruct ( ..) |
8887 PatKind :: Path ( ..) |
89- PatKind :: Ident ( _, _, None ) |
9088 PatKind :: Struct ( ..) => {
9189 match dm. get ( & pat. id ) . map ( |d| d. full_def ( ) ) {
9290 Some ( Def :: Variant ( ..) ) | Some ( Def :: Struct ( ..) ) | Some ( Def :: TyAlias ( ..) ) => true ,
@@ -99,7 +97,7 @@ pub fn pat_is_variant_or_struct(dm: &DefMap, pat: &hir::Pat) -> bool {
9997
10098pub fn pat_is_const ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
10199 match pat. node {
102- PatKind :: Ident ( _ , _ , None ) | PatKind :: Path ( ..) | PatKind :: QPath ( ..) => {
100+ PatKind :: Path ( ..) | PatKind :: QPath ( ..) => {
103101 match dm. get ( & pat. id ) . map ( |d| d. full_def ( ) ) {
104102 Some ( Def :: Const ( ..) ) | Some ( Def :: AssociatedConst ( ..) ) => true ,
105103 _ => false
@@ -113,7 +111,7 @@ pub fn pat_is_const(dm: &DefMap, pat: &hir::Pat) -> bool {
113111// returned instead of a panic.
114112pub fn pat_is_resolved_const ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
115113 match pat. node {
116- PatKind :: Ident ( _ , _ , None ) | PatKind :: Path ( ..) | PatKind :: QPath ( ..) => {
114+ PatKind :: Path ( ..) | PatKind :: QPath ( ..) => {
117115 match dm. get ( & pat. id )
118116 . and_then ( |d| if d. depth == 0 { Some ( d. base_def ) }
119117 else { None } ) {
@@ -125,32 +123,28 @@ pub fn pat_is_resolved_const(dm: &DefMap, pat: &hir::Pat) -> bool {
125123 }
126124}
127125
128- pub fn pat_is_binding ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
126+ pub fn pat_is_binding ( _ : & DefMap , pat : & hir:: Pat ) -> bool {
129127 match pat. node {
130- PatKind :: Ident ( ..) => {
131- !pat_is_variant_or_struct ( dm, pat) &&
132- !pat_is_const ( dm, pat)
133- }
128+ PatKind :: Binding ( ..) => true ,
134129 _ => false
135130 }
136131}
137132
138- pub fn pat_is_binding_or_wild ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
133+ pub fn pat_is_binding_or_wild ( _ : & DefMap , pat : & hir:: Pat ) -> bool {
139134 match pat. node {
140- PatKind :: Ident ( ..) => pat_is_binding ( dm, pat) ,
141- PatKind :: Wild => true ,
135+ PatKind :: Binding ( ..) | PatKind :: Wild => true ,
142136 _ => false
143137 }
144138}
145139
146140/// Call `it` on every "binding" in a pattern, e.g., on `a` in
147141/// `match foo() { Some(a) => (), None => () }`
148- pub fn pat_bindings < I > ( dm : & RefCell < DefMap > , pat : & hir:: Pat , mut it : I ) where
142+ pub fn pat_bindings < I > ( _ : & RefCell < DefMap > , pat : & hir:: Pat , mut it : I ) where
149143 I : FnMut ( hir:: BindingMode , ast:: NodeId , Span , & Spanned < ast:: Name > ) ,
150144{
151145 pat. walk ( |p| {
152146 match p. node {
153- PatKind :: Ident ( binding_mode, ref pth, _) if pat_is_binding ( & dm . borrow ( ) , p ) => {
147+ PatKind :: Binding ( binding_mode, ref pth, _) => {
154148 it ( binding_mode, p. id , p. span , & respan ( pth. span , pth. node ) ) ;
155149 }
156150 _ => { }
@@ -221,7 +215,7 @@ pub fn pat_contains_bindings_or_wild(dm: &DefMap, pat: &hir::Pat) -> bool {
221215
222216pub fn simple_name < ' a > ( pat : & ' a hir:: Pat ) -> Option < ast:: Name > {
223217 match pat. node {
224- PatKind :: Ident ( hir:: BindByValue ( _ ) , ref path1, None ) => {
218+ PatKind :: Binding ( hir:: BindByValue ( .. ) , ref path1, None ) => {
225219 Some ( path1. node )
226220 }
227221 _ => {
@@ -241,7 +235,6 @@ pub fn necessary_variants(dm: &DefMap, pat: &hir::Pat) -> Vec<DefId> {
241235 match p. node {
242236 PatKind :: TupleStruct ( ..) |
243237 PatKind :: Path ( ..) |
244- PatKind :: Ident ( _, _, None ) |
245238 PatKind :: Struct ( ..) => {
246239 match dm. get ( & p. id ) {
247240 Some ( & PathResolution { base_def : Def :: Variant ( _, id) , .. } ) => {
0 commit comments