about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWesley Wiser <wwiser@gmail.com>2019-08-14 08:16:06 -0400
committerWesley Wiser <wwiser@gmail.com>2019-08-22 06:36:31 -0400
commit9fdf5b555181ee6438a9cb01bb38ae5a52049475 (patch)
tree6078279826d01d7f860944def9d71b859deff4a6
parent34fe28bc67817db6743654f8eef8bbf8244f57bf (diff)
downloadrust-9fdf5b555181ee6438a9cb01bb38ae5a52049475.tar.gz
rust-9fdf5b555181ee6438a9cb01bb38ae5a52049475.zip
Remove unnecessary Option
-rw-r--r--src/librustc_mir/transform/mod.rs3
-rw-r--r--src/librustc_mir/transform/qualify_consts.rs6
2 files changed, 4 insertions, 5 deletions
diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs
index f59ad6bae02..c9bcdbe1bef 100644
--- a/src/librustc_mir/transform/mod.rs
+++ b/src/librustc_mir/transform/mod.rs
@@ -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))
 }
 
diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs
index 70a394ad983..7f8ae883429 100644
--- a/src/librustc_mir/transform/qualify_consts.rs
+++ b/src/librustc_mir/transform/qualify_consts.rs
@@ -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()),
         }
     }
 }
@@ -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() {