diff options
| author | ouz-a <oguz.agcayazi@gmail.com> | 2022-04-09 22:23:49 +0300 |
|---|---|---|
| committer | ouz-a <oguz.agcayazi@gmail.com> | 2022-04-09 22:23:49 +0300 |
| commit | 80afd9db2e3871387ecab9c2bdeffc0f970d32d3 (patch) | |
| tree | a66e2f325b52d1a85729341ac2a903ab1ef02eff | |
| parent | cc57656969554bd0dcbf95641bebadc076fac61f (diff) | |
| download | rust-80afd9db2e3871387ecab9c2bdeffc0f970d32d3.tar.gz rust-80afd9db2e3871387ecab9c2bdeffc0f970d32d3.zip | |
remove the if block
| -rw-r--r-- | compiler/rustc_mir_transform/src/deref_separator.rs | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/compiler/rustc_mir_transform/src/deref_separator.rs b/compiler/rustc_mir_transform/src/deref_separator.rs index d8660d4f2fd..24b626ad966 100644 --- a/compiler/rustc_mir_transform/src/deref_separator.rs +++ b/compiler/rustc_mir_transform/src/deref_separator.rs @@ -26,29 +26,16 @@ pub fn deref_finder<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { // We are adding current p_ref's projections to our // temp value, excluding projections we already covered. - if idx == 1 { - let deref_place = Place::from(place_local) - .project_deeper(&p_ref.projection[last_len..], tcx); - patch.add_assign( - loc, - Place::from(temp), - Rvalue::Use(Operand::Move(deref_place)), - ); + let deref_place = Place::from(place_local) + .project_deeper(&p_ref.projection[last_len..], tcx); + patch.add_assign( + loc, + Place::from(temp), + Rvalue::Use(Operand::Move(deref_place)), + ); - place_local = temp; - last_len = p_ref.projection.len(); - } else { - let deref_place = Place::from(place_local) - .project_deeper(&p_ref.projection[last_len..], tcx); - patch.add_assign( - loc, - Place::from(temp), - Rvalue::Use(Operand::Move(deref_place)), - ); - - place_local = temp; - last_len = p_ref.projection.len(); - } + place_local = temp; + last_len = p_ref.projection.len(); // We are creating a place by using our temp value's location // and copying derefed values which we need to create new statement. |
