@@ -331,18 +331,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
331331 match place {
332332 PlaceRef { local, projection : [ ] } => {
333333 let local = & self . body . local_decls [ local] ;
334- self . describe_field_from_ty ( & local. ty , field, None )
334+ self . describe_field_from_ty ( local. ty , field, None )
335335 }
336336 PlaceRef { local, projection : [ proj_base @ .., elem] } => match elem {
337337 ProjectionElem :: Deref => {
338338 self . describe_field ( PlaceRef { local, projection : proj_base } , field)
339339 }
340340 ProjectionElem :: Downcast ( _, variant_index) => {
341341 let base_ty = place. ty ( self . body , self . infcx . tcx ) . ty ;
342- self . describe_field_from_ty ( & base_ty, field, Some ( * variant_index) )
342+ self . describe_field_from_ty ( base_ty, field, Some ( * variant_index) )
343343 }
344344 ProjectionElem :: Field ( _, field_type) => {
345- self . describe_field_from_ty ( & field_type, field, None )
345+ self . describe_field_from_ty ( * field_type, field, None )
346346 }
347347 ProjectionElem :: Index ( ..)
348348 | ProjectionElem :: ConstantIndex { .. }
@@ -362,7 +362,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
362362 ) -> String {
363363 if ty. is_box ( ) {
364364 // If the type is a box, the field is described from the boxed type
365- self . describe_field_from_ty ( & ty. boxed_ty ( ) , field, variant_index)
365+ self . describe_field_from_ty ( ty. boxed_ty ( ) , field, variant_index)
366366 } else {
367367 match * ty. kind ( ) {
368368 ty:: Adt ( def, _) => {
@@ -376,10 +376,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
376376 }
377377 ty:: Tuple ( _) => field. index ( ) . to_string ( ) ,
378378 ty:: Ref ( _, ty, _) | ty:: RawPtr ( ty:: TypeAndMut { ty, .. } ) => {
379- self . describe_field_from_ty ( & ty, field, variant_index)
379+ self . describe_field_from_ty ( ty, field, variant_index)
380380 }
381381 ty:: Array ( ty, _) | ty:: Slice ( ty) => {
382- self . describe_field_from_ty ( & ty, field, variant_index)
382+ self . describe_field_from_ty ( ty, field, variant_index)
383383 }
384384 ty:: Closure ( def_id, _) | ty:: Generator ( def_id, _, _) => {
385385 // We won't be borrowck'ing here if the closure came from another crate,
@@ -497,14 +497,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
497497 // We need to add synthesized lifetimes where appropriate. We do
498498 // this by hooking into the pretty printer and telling it to label the
499499 // lifetimes without names with the value `'0`.
500- match ty. kind ( ) {
501- ty :: Ref (
502- ty:: RegionKind :: ReLateBound ( _, ty:: BoundRegion { kind : br, .. } )
503- | ty:: RegionKind :: RePlaceholder ( ty:: PlaceholderRegion { name : br, .. } ) ,
504- _ ,
505- _ ,
506- ) => printer . region_highlight_mode . highlighting_bound_region ( * br , counter ) ,
507- _ => { }
500+ if let ty :: Ref ( region , .. ) = ty. kind ( ) {
501+ match * * region {
502+ ty:: ReLateBound ( _, ty:: BoundRegion { kind : br, .. } )
503+ | ty:: RePlaceholder ( ty:: PlaceholderRegion { name : br, .. } ) => {
504+ printer . region_highlight_mode . highlighting_bound_region ( br , counter )
505+ }
506+ _ => { }
507+ }
508508 }
509509
510510 let _ = ty. print ( printer) ;
@@ -517,19 +517,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
517517 let mut s = String :: new ( ) ;
518518 let mut printer = ty:: print:: FmtPrinter :: new ( self . infcx . tcx , & mut s, Namespace :: TypeNS ) ;
519519
520- let region = match ty. kind ( ) {
521- ty:: Ref ( region, _, _) => {
522- match region {
523- ty:: RegionKind :: ReLateBound ( _, ty:: BoundRegion { kind : br, .. } )
524- | ty:: RegionKind :: RePlaceholder ( ty:: PlaceholderRegion { name : br, .. } ) => {
525- printer. region_highlight_mode . highlighting_bound_region ( * br, counter)
526- }
527- _ => { }
520+ let region = if let ty:: Ref ( region, ..) = ty. kind ( ) {
521+ match * * region {
522+ ty:: ReLateBound ( _, ty:: BoundRegion { kind : br, .. } )
523+ | ty:: RePlaceholder ( ty:: PlaceholderRegion { name : br, .. } ) => {
524+ printer. region_highlight_mode . highlighting_bound_region ( br, counter)
528525 }
529-
530- region
526+ _ => { }
531527 }
532- _ => bug ! ( "ty for annotation of borrow region is not a reference" ) ,
528+ region
529+ } else {
530+ bug ! ( "ty for annotation of borrow region is not a reference" ) ;
533531 } ;
534532
535533 let _ = region. print ( printer) ;
0 commit comments