@@ -439,17 +439,17 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
439439 Operand :: Move ( Place :: Local ( from) ) if * from == target => {
440440 debug ! ( "was_captured_by_trait_object: ty={:?}" , ty) ;
441441 // Check the type for a trait object.
442- match ty. sty {
442+ return match ty. sty {
443443 // `&dyn Trait`
444- ty:: TyKind :: Ref ( _, ty, _) if ty. is_trait ( ) => return true ,
444+ ty:: TyKind :: Ref ( _, ty, _) if ty. is_trait ( ) => true ,
445445 // `Box<dyn Trait>`
446446 _ if ty. is_box ( ) && ty. boxed_ty ( ) . is_trait ( ) =>
447- return true ,
447+ true ,
448448 // `dyn Trait`
449- _ if ty. is_trait ( ) => return true ,
449+ _ if ty. is_trait ( ) => true ,
450450 // Anything else.
451- _ => return false ,
452- }
451+ _ => false ,
452+ } ;
453453 } ,
454454 _ => return false ,
455455 } ,
@@ -464,32 +464,29 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
464464 let terminator = block. terminator ( ) ;
465465 debug ! ( "was_captured_by_trait_object: terminator={:?}" , terminator) ;
466466
467- match & terminator. kind {
468- TerminatorKind :: Call {
469- destination : Some ( ( Place :: Local ( dest) , block) ) ,
470- args,
471- ..
472- } => {
473- debug ! (
474- "was_captured_by_trait_object: target={:?} dest={:?} args={:?}" ,
475- target, dest, args
476- ) ;
477- // Check if one of the arguments to this function is the target place.
478- let found_target = args. iter ( ) . any ( |arg| {
479- if let Operand :: Move ( Place :: Local ( potential) ) = arg {
480- * potential == target
481- } else {
482- false
483- }
484- } ) ;
485-
486- // If it is, follow this to the next block and update the target.
487- if found_target {
488- target = * dest;
489- queue. push ( block. start_location ( ) ) ;
467+ if let TerminatorKind :: Call {
468+ destination : Some ( ( Place :: Local ( dest) , block) ) ,
469+ args,
470+ ..
471+ } = & terminator. kind {
472+ debug ! (
473+ "was_captured_by_trait_object: target={:?} dest={:?} args={:?}" ,
474+ target, dest, args
475+ ) ;
476+ // Check if one of the arguments to this function is the target place.
477+ let found_target = args. iter ( ) . any ( |arg| {
478+ if let Operand :: Move ( Place :: Local ( potential) ) = arg {
479+ * potential == target
480+ } else {
481+ false
490482 }
491- } ,
492- _ => { } ,
483+ } ) ;
484+
485+ // If it is, follow this to the next block and update the target.
486+ if found_target {
487+ target = * dest;
488+ queue. push ( block. start_location ( ) ) ;
489+ }
493490 }
494491 }
495492
0 commit comments