Skip to content

Commit 80afd9d

Browse files
committed
remove the if block
1 parent cc57656 commit 80afd9d

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

compiler/rustc_mir_transform/src/deref_separator.rs

+9-22
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,16 @@ pub fn deref_finder<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
2626

2727
// We are adding current p_ref's projections to our
2828
// temp value, excluding projections we already covered.
29-
if idx == 1 {
30-
let deref_place = Place::from(place_local)
31-
.project_deeper(&p_ref.projection[last_len..], tcx);
32-
patch.add_assign(
33-
loc,
34-
Place::from(temp),
35-
Rvalue::Use(Operand::Move(deref_place)),
36-
);
29+
let deref_place = Place::from(place_local)
30+
.project_deeper(&p_ref.projection[last_len..], tcx);
31+
patch.add_assign(
32+
loc,
33+
Place::from(temp),
34+
Rvalue::Use(Operand::Move(deref_place)),
35+
);
3736

38-
place_local = temp;
39-
last_len = p_ref.projection.len();
40-
} else {
41-
let deref_place = Place::from(place_local)
42-
.project_deeper(&p_ref.projection[last_len..], tcx);
43-
patch.add_assign(
44-
loc,
45-
Place::from(temp),
46-
Rvalue::Use(Operand::Move(deref_place)),
47-
);
48-
49-
place_local = temp;
50-
last_len = p_ref.projection.len();
51-
}
37+
place_local = temp;
38+
last_len = p_ref.projection.len();
5239

5340
// We are creating a place by using our temp value's location
5441
// and copying derefed values which we need to create new statement.

0 commit comments

Comments
 (0)