@@ -78,7 +78,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
7878 if let StatementKind :: Assign ( box ( into, Rvalue :: Use ( from) ) ) = & stmt. kind {
7979 debug ! ( "add_fnonce_closure_note: into={:?} from={:?}" , into, from) ;
8080 match from {
81- Operand :: Copy ( ref place) | Operand :: Move ( ref place)
81+ Operand :: Copy ( place) | Operand :: Move ( place)
8282 if target == place. local_or_deref_local ( ) =>
8383 {
8484 target = into. local_or_deref_local ( )
@@ -101,7 +101,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
101101 debug ! ( "add_moved_or_invoked_closure_note: id={:?}" , id) ;
102102 if Some ( self . infcx . tcx . parent ( id) ) == self . infcx . tcx . lang_items ( ) . fn_once_trait ( ) {
103103 let closure = match args. first ( ) {
104- Some ( Operand :: Copy ( ref place) ) | Some ( Operand :: Move ( ref place) )
104+ Some ( Operand :: Copy ( place) | Operand :: Move ( place) )
105105 if target == place. local_or_deref_local ( ) =>
106106 {
107107 place. local_or_deref_local ( ) . unwrap ( )
@@ -439,9 +439,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
439439 if !is_terminator {
440440 continue ;
441441 } else if let Some ( Terminator {
442- kind : TerminatorKind :: Call { ref func, from_hir_call : false , .. } ,
442+ kind : TerminatorKind :: Call { func, from_hir_call : false , .. } ,
443443 ..
444- } ) = bbd. terminator
444+ } ) = & bbd. terminator
445445 {
446446 if let Some ( source) =
447447 BorrowedContentSource :: from_call ( func. ty ( self . body , tcx) , tcx)
@@ -811,33 +811,30 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
811811 } ;
812812
813813 debug ! ( "move_spans: moved_place={:?} location={:?} stmt={:?}" , moved_place, location, stmt) ;
814- if let StatementKind :: Assign ( box ( _, Rvalue :: Aggregate ( ref kind, ref places) ) ) = stmt. kind {
815- match * * kind {
816- AggregateKind :: Closure ( def_id, _) | AggregateKind :: Generator ( def_id, _, _) => {
817- debug ! ( "move_spans: def_id={:?} places={:?}" , def_id, places) ;
818- if let Some ( ( args_span, generator_kind, capture_kind_span, path_span) ) =
819- self . closure_span ( def_id, moved_place, places)
820- {
821- return ClosureUse {
822- generator_kind,
823- args_span,
824- capture_kind_span,
825- path_span,
826- } ;
827- }
828- }
829- _ => { }
814+ if let StatementKind :: Assign ( box ( _, Rvalue :: Aggregate ( kind, places) ) ) = & stmt. kind
815+ && let AggregateKind :: Closure ( def_id, _) | AggregateKind :: Generator ( def_id, _, _) = * * kind
816+ {
817+ debug ! ( "move_spans: def_id={:?} places={:?}" , def_id, places) ;
818+ if let Some ( ( args_span, generator_kind, capture_kind_span, path_span) ) =
819+ self . closure_span ( def_id, moved_place, places)
820+ {
821+ return ClosureUse {
822+ generator_kind,
823+ args_span,
824+ capture_kind_span,
825+ path_span,
826+ } ;
830827 }
831828 }
832829
833830 // StatementKind::FakeRead only contains a def_id if they are introduced as a result
834831 // of pattern matching within a closure.
835- if let StatementKind :: FakeRead ( box ( cause, ref place) ) = stmt. kind {
832+ if let StatementKind :: FakeRead ( box ( cause, place) ) = stmt. kind {
836833 match cause {
837834 FakeReadCause :: ForMatchedPlace ( Some ( closure_def_id) )
838835 | FakeReadCause :: ForLet ( Some ( closure_def_id) ) => {
839836 debug ! ( "move_spans: def_id={:?} place={:?}" , closure_def_id, place) ;
840- let places = & [ Operand :: Move ( * place) ] ;
837+ let places = & [ Operand :: Move ( place) ] ;
841838 if let Some ( ( args_span, generator_kind, capture_kind_span, path_span) ) =
842839 self . closure_span ( closure_def_id, moved_place, places)
843840 {
@@ -924,7 +921,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
924921 debug ! ( "borrow_spans: use_span={:?} location={:?}" , use_span, location) ;
925922
926923 let target = match self . body [ location. block ] . statements . get ( location. statement_index ) {
927- Some ( & Statement { kind : StatementKind :: Assign ( box ( ref place, _) ) , .. } ) => {
924+ Some ( Statement { kind : StatementKind :: Assign ( box ( place, _) ) , .. } ) => {
928925 if let Some ( local) = place. as_local ( ) {
929926 local
930927 } else {
@@ -940,9 +937,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
940937 }
941938
942939 for stmt in & self . body [ location. block ] . statements [ location. statement_index + 1 ..] {
943- if let StatementKind :: Assign ( box ( _, Rvalue :: Aggregate ( ref kind, ref places) ) ) =
944- stmt. kind
945- {
940+ if let StatementKind :: Assign ( box ( _, Rvalue :: Aggregate ( kind, places) ) ) = & stmt. kind {
946941 let ( & def_id, is_generator) = match kind {
947942 box AggregateKind :: Closure ( def_id, _) => ( def_id, false ) ,
948943 box AggregateKind :: Generator ( def_id, _, _) => ( def_id, true ) ,
0 commit comments