@@ -78,7 +78,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
78
78
if let StatementKind :: Assign ( box ( into, Rvalue :: Use ( from) ) ) = & stmt. kind {
79
79
debug ! ( "add_fnonce_closure_note: into={:?} from={:?}" , into, from) ;
80
80
match from {
81
- Operand :: Copy ( ref place) | Operand :: Move ( ref place)
81
+ Operand :: Copy ( place) | Operand :: Move ( place)
82
82
if target == place. local_or_deref_local ( ) =>
83
83
{
84
84
target = into. local_or_deref_local ( )
@@ -101,7 +101,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
101
101
debug ! ( "add_moved_or_invoked_closure_note: id={:?}" , id) ;
102
102
if Some ( self . infcx . tcx . parent ( id) ) == self . infcx . tcx . lang_items ( ) . fn_once_trait ( ) {
103
103
let closure = match args. first ( ) {
104
- Some ( Operand :: Copy ( ref place) ) | Some ( Operand :: Move ( ref place) )
104
+ Some ( Operand :: Copy ( place) | Operand :: Move ( place) )
105
105
if target == place. local_or_deref_local ( ) =>
106
106
{
107
107
place. local_or_deref_local ( ) . unwrap ( )
@@ -439,9 +439,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
439
439
if !is_terminator {
440
440
continue ;
441
441
} else if let Some ( Terminator {
442
- kind : TerminatorKind :: Call { ref func, from_hir_call : false , .. } ,
442
+ kind : TerminatorKind :: Call { func, from_hir_call : false , .. } ,
443
443
..
444
- } ) = bbd. terminator
444
+ } ) = & bbd. terminator
445
445
{
446
446
if let Some ( source) =
447
447
BorrowedContentSource :: from_call ( func. ty ( self . body , tcx) , tcx)
@@ -811,33 +811,30 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
811
811
} ;
812
812
813
813
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
+ } ;
830
827
}
831
828
}
832
829
833
830
// StatementKind::FakeRead only contains a def_id if they are introduced as a result
834
831
// 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 {
836
833
match cause {
837
834
FakeReadCause :: ForMatchedPlace ( Some ( closure_def_id) )
838
835
| FakeReadCause :: ForLet ( Some ( closure_def_id) ) => {
839
836
debug ! ( "move_spans: def_id={:?} place={:?}" , closure_def_id, place) ;
840
- let places = & [ Operand :: Move ( * place) ] ;
837
+ let places = & [ Operand :: Move ( place) ] ;
841
838
if let Some ( ( args_span, generator_kind, capture_kind_span, path_span) ) =
842
839
self . closure_span ( closure_def_id, moved_place, places)
843
840
{
@@ -924,7 +921,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
924
921
debug ! ( "borrow_spans: use_span={:?} location={:?}" , use_span, location) ;
925
922
926
923
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, _) ) , .. } ) => {
928
925
if let Some ( local) = place. as_local ( ) {
929
926
local
930
927
} else {
@@ -940,9 +937,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
940
937
}
941
938
942
939
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 {
946
941
let ( & def_id, is_generator) = match kind {
947
942
box AggregateKind :: Closure ( def_id, _) => ( def_id, false ) ,
948
943
box AggregateKind :: Generator ( def_id, _, _) => ( def_id, true ) ,
0 commit comments