@@ -168,7 +168,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
168
168
let scrutinee_place =
169
169
unpack ! ( block = self . lower_scrutinee( block, scrutinee, scrutinee_span, ) ) ;
170
170
171
- let mut arm_candidates = self . create_match_candidates ( scrutinee_place. clone ( ) , & arms) ;
171
+ let mut arm_candidates = self . create_match_candidates ( & scrutinee_place, & arms) ;
172
172
173
173
let match_has_guard = arm_candidates. iter ( ) . any ( |( _, candidate) | candidate. has_guard ) ;
174
174
let mut candidates =
@@ -230,7 +230,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
230
230
/// Create the initial `Candidate`s for a `match` expression.
231
231
fn create_match_candidates < ' pat > (
232
232
& mut self ,
233
- scrutinee : PlaceBuilder < ' tcx > ,
233
+ scrutinee : & PlaceBuilder < ' tcx > ,
234
234
arms : & ' pat [ ArmId ] ,
235
235
) -> Vec < ( & ' pat Arm < ' tcx > , Candidate < ' pat , ' tcx > ) >
236
236
where
@@ -1332,15 +1332,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1332
1332
bug ! ( "Or-patterns should have been sorted to the end" ) ;
1333
1333
} ;
1334
1334
let or_span = match_pair. pattern . span ;
1335
- let place = match_pair. place ;
1336
1335
1337
1336
first_candidate. visit_leaves ( |leaf_candidate| {
1338
1337
self . test_or_pattern (
1339
1338
leaf_candidate,
1340
1339
& mut otherwise,
1341
1340
pats,
1342
1341
or_span,
1343
- place . clone ( ) ,
1342
+ & match_pair . place ,
1344
1343
fake_borrows,
1345
1344
) ;
1346
1345
} ) ;
@@ -1368,7 +1367,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1368
1367
otherwise : & mut Option < BasicBlock > ,
1369
1368
pats : & ' pat [ Box < Pat < ' tcx > > ] ,
1370
1369
or_span : Span ,
1371
- place : PlaceBuilder < ' tcx > ,
1370
+ place : & PlaceBuilder < ' tcx > ,
1372
1371
fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1373
1372
) {
1374
1373
debug ! ( "candidate={:#?}\n pats={:#?}" , candidate, pats) ;
@@ -1607,7 +1606,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1607
1606
// encounter a candidate where the test is not relevant; at
1608
1607
// that point, we stop sorting.
1609
1608
while let Some ( candidate) = candidates. first_mut ( ) {
1610
- let Some ( idx) = self . sort_candidate ( & match_place. clone ( ) , & test, candidate) else {
1609
+ let Some ( idx) = self . sort_candidate ( & match_place, & test, candidate) else {
1611
1610
break ;
1612
1611
} ;
1613
1612
let ( candidate, rest) = candidates. split_first_mut ( ) . unwrap ( ) ;
@@ -1676,7 +1675,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1676
1675
target_blocks
1677
1676
} ;
1678
1677
1679
- self . perform_test ( span, scrutinee_span, block, match_place, & test, make_target_blocks) ;
1678
+ self . perform_test ( span, scrutinee_span, block, & match_place, & test, make_target_blocks) ;
1680
1679
}
1681
1680
1682
1681
/// Determine the fake borrows that are needed from a set of places that
0 commit comments