Skip to content

Commit

Permalink
Remove unnecessary Option
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleywiser committed Aug 22, 2019
1 parent 34fe28b commit 9fdf5b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/librustc_mir/transform/mod.rs
Expand Up @@ -218,8 +218,7 @@ fn mir_validated(
&qualify_and_promote_pass,
&simplify::SimplifyCfg::new("qualify-consts"),
]);
let promoted =
qualify_and_promote_pass.promoted.into_inner().unwrap_or_else(|| IndexVec::new());
let promoted = qualify_and_promote_pass.promoted.into_inner();
(tcx.alloc_steal_mir(body), tcx.alloc_steal_promoted(promoted))
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/transform/qualify_consts.rs
Expand Up @@ -1572,13 +1572,13 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def_id: DefId) -> (u8, &BitSet<Local>) {
}

pub struct QualifyAndPromoteConstants<'tcx> {
pub promoted: Cell<Option<IndexVec<Promoted, Body<'tcx>>>>,
pub promoted: Cell<IndexVec<Promoted, Body<'tcx>>>,
}

impl<'tcx> Default for QualifyAndPromoteConstants<'tcx> {
fn default() -> Self {
QualifyAndPromoteConstants {
promoted: Cell::new(None),
promoted: Cell::new(IndexVec::new()),
}
}
}
Expand Down Expand Up @@ -1661,7 +1661,7 @@ impl<'tcx> MirPass<'tcx> for QualifyAndPromoteConstants<'tcx> {

// Do the actual promotion, now that we know what's viable.
self.promoted.set(
Some(promote_consts::promote_candidates(def_id, body, tcx, temps, candidates))
promote_consts::promote_candidates(def_id, body, tcx, temps, candidates)
);
} else {
if !body.control_flow_destroyed.is_empty() {
Expand Down

0 comments on commit 9fdf5b5

Please sign in to comment.