@@ -30,7 +30,9 @@ use syntax::print::pprust;
3030use syntax:: ptr:: P ;
3131
3232pub 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+ {
3436 let fcx = pcx. fcx ;
3537 let tcx = pcx. fcx . ccx . tcx ;
3638
@@ -90,7 +92,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
9092 }
9193 } else {
9294 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" ) ;
9496 }
9597
9698 fcx. write_ty ( pat. id , lhs_ty) ;
@@ -154,8 +156,9 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
154156 check_pat_struct ( pcx, pat, path, fields. as_slice ( ) , etc, expected) ;
155157 }
156158 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 ( ) ;
159162 let pat_ty = ty:: mk_tup ( tcx, element_tys. clone ( ) ) ;
160163 fcx. write_ty ( pat. id , pat_ty) ;
161164 demand:: eqtype ( fcx, pat. span , expected, pat_ty) ;
@@ -183,8 +186,8 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
183186 let inner_ty = fcx. infcx ( ) . next_ty_var ( ) ;
184187
185188 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 ) ;
188191
189192 let mt = ty:: mt { ty : inner_ty, mutbl : mutbl } ;
190193 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>,
217220 let region = fcx. infcx ( ) . next_region_var ( infer:: PatternRegion ( pat. span ) ) ;
218221 ty:: mk_slice ( tcx, tcx. mk_region ( region) , ty:: mt {
219222 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 )
222225 } )
223226 }
224227 } ;
0 commit comments