Skip to content

Commit 9fdf5b5

Browse files
committed
Remove unnecessary Option
1 parent 34fe28b commit 9fdf5b5

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/librustc_mir/transform/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ fn mir_validated(
218218
&qualify_and_promote_pass,
219219
&simplify::SimplifyCfg::new("qualify-consts"),
220220
]);
221-
let promoted =
222-
qualify_and_promote_pass.promoted.into_inner().unwrap_or_else(|| IndexVec::new());
221+
let promoted = qualify_and_promote_pass.promoted.into_inner();
223222
(tcx.alloc_steal_mir(body), tcx.alloc_steal_promoted(promoted))
224223
}
225224

src/librustc_mir/transform/qualify_consts.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1572,13 +1572,13 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def_id: DefId) -> (u8, &BitSet<Local>) {
15721572
}
15731573

15741574
pub struct QualifyAndPromoteConstants<'tcx> {
1575-
pub promoted: Cell<Option<IndexVec<Promoted, Body<'tcx>>>>,
1575+
pub promoted: Cell<IndexVec<Promoted, Body<'tcx>>>,
15761576
}
15771577

15781578
impl<'tcx> Default for QualifyAndPromoteConstants<'tcx> {
15791579
fn default() -> Self {
15801580
QualifyAndPromoteConstants {
1581-
promoted: Cell::new(None),
1581+
promoted: Cell::new(IndexVec::new()),
15821582
}
15831583
}
15841584
}
@@ -1661,7 +1661,7 @@ impl<'tcx> MirPass<'tcx> for QualifyAndPromoteConstants<'tcx> {
16611661

16621662
// Do the actual promotion, now that we know what's viable.
16631663
self.promoted.set(
1664-
Some(promote_consts::promote_candidates(def_id, body, tcx, temps, candidates))
1664+
promote_consts::promote_candidates(def_id, body, tcx, temps, candidates)
16651665
);
16661666
} else {
16671667
if !body.control_flow_destroyed.is_empty() {

0 commit comments

Comments
 (0)