@@ -30,7 +30,9 @@ use syntax::print::pprust;
30
30
use syntax:: ptr:: P ;
31
31
32
32
pub fn check_pat < ' a , ' tcx > ( pcx : & pat_ctxt < ' a , ' tcx > ,
33
- pat : & ast:: Pat , expected : Ty < ' tcx > ) {
33
+ pat : & ast:: Pat ,
34
+ expected : Ty < ' tcx > )
35
+ {
34
36
let fcx = pcx. fcx ;
35
37
let tcx = pcx. fcx . ccx . tcx ;
36
38
@@ -90,7 +92,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
90
92
}
91
93
} else {
92
94
span_err ! ( tcx. sess, begin. span, E0029 ,
93
- "only char and numeric types are allowed in range" ) ;
95
+ "only char and numeric types are allowed in range" ) ;
94
96
}
95
97
96
98
fcx. write_ty ( pat. id , lhs_ty) ;
@@ -154,8 +156,9 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
154
156
check_pat_struct ( pcx, pat, path, fields. as_slice ( ) , etc, expected) ;
155
157
}
156
158
ast:: PatTup ( ref elements) => {
157
- let element_tys: Vec < _ > = range ( 0 , elements. len ( ) ) . map ( |_| fcx. infcx ( )
158
- . next_ty_var ( ) ) . collect ( ) ;
159
+ let element_tys: Vec < _ > =
160
+ range ( 0 , elements. len ( ) ) . map ( |_| fcx. infcx ( ) . next_ty_var ( ) )
161
+ . collect ( ) ;
159
162
let pat_ty = ty:: mk_tup ( tcx, element_tys. clone ( ) ) ;
160
163
fcx. write_ty ( pat. id , pat_ty) ;
161
164
demand:: eqtype ( fcx, pat. span , expected, pat_ty) ;
@@ -183,8 +186,8 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
183
186
let inner_ty = fcx. infcx ( ) . next_ty_var ( ) ;
184
187
185
188
let mutbl =
186
- ty:: deref ( fcx. infcx ( ) . shallow_resolve ( expected) , true )
187
- . map_or ( ast:: MutImmutable , |mt| mt . mutbl ) ;
189
+ ty:: deref ( fcx. infcx ( ) . shallow_resolve ( expected) , true ) . map ( |mt| mt . mutbl )
190
+ . unwrap_or ( ast:: MutImmutable ) ;
188
191
189
192
let mt = ty:: mt { ty : inner_ty, mutbl : mutbl } ;
190
193
let region = fcx. infcx ( ) . next_region_var ( infer:: PatternRegion ( pat. span ) ) ;
@@ -217,8 +220,8 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
217
220
let region = fcx. infcx ( ) . next_region_var ( infer:: PatternRegion ( pat. span ) ) ;
218
221
ty:: mk_slice ( tcx, tcx. mk_region ( region) , ty:: mt {
219
222
ty : inner_ty,
220
- mutbl : ty:: deref ( expected_ty, true )
221
- . map_or ( ast:: MutImmutable , |mt| mt . mutbl )
223
+ mutbl : ty:: deref ( expected_ty, true ) . map ( |mt| mt . mutbl )
224
+ . unwrap_or ( ast:: MutImmutable )
222
225
} )
223
226
}
224
227
} ;
0 commit comments