@@ -93,7 +93,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
9393 let scrutinee_place =
9494 unpack ! ( block = self . lower_scrutinee( block, scrutinee, scrutinee_span, ) ) ;
9595
96- let mut arm_candidates = self . create_match_candidates ( & scrutinee_place, & arms) ;
96+ let mut arm_candidates = self . create_match_candidates ( scrutinee_place, & arms) ;
9797
9898 let match_has_guard = arms. iter ( ) . any ( |arm| arm. guard . is_some ( ) ) ;
9999 let mut candidates =
@@ -103,7 +103,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
103103 self . lower_match_tree ( block, scrutinee_span, match_has_guard, & mut candidates) ;
104104
105105 self . lower_match_arms (
106- & destination,
106+ destination,
107107 scrutinee_place,
108108 scrutinee_span,
109109 arm_candidates,
@@ -137,23 +137,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
137137 // check safety.
138138 let cause_matched_place = FakeReadCause :: ForMatchedPlace ;
139139 let source_info = self . source_info ( scrutinee_span) ;
140- self . cfg . push_fake_read ( block, source_info, cause_matched_place, scrutinee_place. clone ( ) ) ;
140+ self . cfg . push_fake_read ( block, source_info, cause_matched_place, scrutinee_place) ;
141141
142142 block. and ( scrutinee_place)
143143 }
144144
145145 /// Create the initial `Candidate`s for a `match` expression.
146146 fn create_match_candidates < ' pat > (
147147 & mut self ,
148- scrutinee : & Place < ' tcx > ,
148+ scrutinee : Place < ' tcx > ,
149149 arms : & ' pat [ Arm < ' tcx > ] ,
150150 ) -> Vec < ( & ' pat Arm < ' tcx > , Candidate < ' pat , ' tcx > ) > {
151151 // Assemble a list of candidates: there is one candidate per pattern,
152152 // which means there may be more than one candidate *per arm*.
153153 arms. iter ( )
154154 . map ( |arm| {
155155 let arm_has_guard = arm. guard . is_some ( ) ;
156- let arm_candidate = Candidate :: new ( * scrutinee, & arm. pattern , arm_has_guard) ;
156+ let arm_candidate = Candidate :: new ( scrutinee, & arm. pattern , arm_has_guard) ;
157157 ( arm, arm_candidate)
158158 } )
159159 . collect ( )
@@ -391,7 +391,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
391391 // Inject a fake read, see comments on `FakeReadCause::ForLet`.
392392 let pattern_source_info = self . source_info ( irrefutable_pat. span ) ;
393393 let cause_let = FakeReadCause :: ForLet ;
394- self . cfg . push_fake_read ( block, pattern_source_info, cause_let, place. clone ( ) ) ;
394+ self . cfg . push_fake_read ( block, pattern_source_info, cause_let, place) ;
395395
396396 let ty_source_info = self . source_info ( user_ty_span) ;
397397 let user_ty = pat_ascription_ty. user_ty (
@@ -430,7 +430,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
430430
431431 _ => {
432432 let place = unpack ! ( block = self . as_place( block, initializer) ) ;
433- self . place_into_pattern ( block, irrefutable_pat, & place, true )
433+ self . place_into_pattern ( block, irrefutable_pat, place, true )
434434 }
435435 }
436436 }
@@ -439,10 +439,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
439439 & mut self ,
440440 block : BasicBlock ,
441441 irrefutable_pat : Pat < ' tcx > ,
442- initializer : & Place < ' tcx > ,
442+ initializer : Place < ' tcx > ,
443443 set_match_place : bool ,
444444 ) -> BlockAnd < ( ) > {
445- let mut candidate = Candidate :: new ( * initializer, & irrefutable_pat, false ) ;
445+ let mut candidate = Candidate :: new ( initializer, & irrefutable_pat, false ) ;
446446
447447 let fake_borrow_temps =
448448 self . lower_match_tree ( block, irrefutable_pat. span , false , & mut [ & mut candidate] ) ;
@@ -461,7 +461,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
461461 VarBindingForm { opt_match_place : Some ( ( ref mut match_place, _) ) , .. } ,
462462 ) ) ) = self . local_decls [ local] . local_info
463463 {
464- * match_place = Some ( * initializer) ;
464+ * match_place = Some ( initializer) ;
465465 } else {
466466 bug ! ( "Let binding to non-user variable." )
467467 }
@@ -897,7 +897,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
897897 span : Span ,
898898 start_block : BasicBlock ,
899899 otherwise_block : & mut Option < BasicBlock > ,
900- candidates : & mut [ & mut Candidate < _ , ' tcx > ] ,
900+ candidates : & mut [ & mut Candidate < ' _ , ' tcx > ] ,
901901 fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
902902 ) {
903903 // The candidates are sorted by priority. Check to see whether the
@@ -1121,7 +1121,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
11211121 for match_pair in match_pairs {
11221122 if let PatKind :: Or { ref pats } = * match_pair. pattern . kind {
11231123 let or_span = match_pair. pattern . span ;
1124- let place = & match_pair. place ;
1124+ let place = match_pair. place ;
11251125
11261126 first_candidate. visit_leaves ( |leaf_candidate| {
11271127 self . test_or_pattern (
@@ -1155,14 +1155,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
11551155 otherwise : & mut Option < BasicBlock > ,
11561156 pats : & ' pat [ Pat < ' tcx > ] ,
11571157 or_span : Span ,
1158- place : & Place < ' tcx > ,
1158+ place : Place < ' tcx > ,
11591159 fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
11601160 ) {
11611161 debug ! ( "test_or_pattern:\n candidate={:#?}\n pats={:#?}" , candidate, pats) ;
1162- let mut or_candidates: Vec < _ > = pats
1163- . iter ( )
1164- . map ( |pat| Candidate :: new ( place. clone ( ) , pat, candidate. has_guard ) )
1165- . collect ( ) ;
1162+ let mut or_candidates: Vec < _ > =
1163+ pats. iter ( ) . map ( |pat| Candidate :: new ( place, pat, candidate. has_guard ) ) . collect ( ) ;
11661164 let mut or_candidate_refs: Vec < _ > = or_candidates. iter_mut ( ) . collect ( ) ;
11671165 let otherwise = if candidate. otherwise_block . is_some ( ) {
11681166 & mut candidate. otherwise_block
@@ -1368,7 +1366,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13681366 }
13691367
13701368 // Insert a Shallow borrow of any places that is switched on.
1371- fake_borrows. as_mut ( ) . map ( |fb| fb. insert ( match_place. clone ( ) ) ) ;
1369+ fake_borrows. as_mut ( ) . map ( |fb| fb. insert ( match_place) ) ;
13721370
13731371 // perform the test, branching to one of N blocks. For each of
13741372 // those N possible outcomes, create a (initially empty)
@@ -1448,7 +1446,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
14481446 target_blocks
14491447 } ;
14501448
1451- self . perform_test ( block, & match_place, & test, make_target_blocks) ;
1449+ self . perform_test ( block, match_place, & test, make_target_blocks) ;
14521450 }
14531451
14541452 /// Determine the fake borrows that are needed from a set of places that
@@ -1669,9 +1667,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
16691667
16701668 let re_erased = tcx. lifetimes . re_erased ;
16711669 let scrutinee_source_info = self . source_info ( scrutinee_span) ;
1672- for ( place, temp) in fake_borrows {
1673- let borrow = Rvalue :: Ref ( re_erased, BorrowKind :: Shallow , * place) ;
1674- self . cfg . push_assign ( block, scrutinee_source_info, & Place :: from ( * temp) , borrow) ;
1670+ for & ( place, temp) in fake_borrows {
1671+ let borrow = Rvalue :: Ref ( re_erased, BorrowKind :: Shallow , place) ;
1672+ self . cfg . push_assign ( block, scrutinee_source_info, & Place :: from ( temp) , borrow) ;
16751673 }
16761674
16771675 // the block to branch to if the guard fails; if there is no
0 commit comments