Skip to content

Commit 6ce0ef5

Browse files
authored
Rollup merge of #90452 - tmiasko:promote-candidate, r=cjgillot
Remove unnecessary `Option` from `promote_candidate` return type
2 parents 86f5b8a + 3a95338 commit 6ce0ef5

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

compiler/rustc_const_eval/src/transform/promote_consts.rs

+5-11
Original file line numberDiff line numberDiff line change
@@ -835,11 +835,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
835835
new_temp
836836
}
837837

838-
fn promote_candidate(
839-
mut self,
840-
candidate: Candidate,
841-
next_promoted_id: usize,
842-
) -> Option<Body<'tcx>> {
838+
fn promote_candidate(mut self, candidate: Candidate, next_promoted_id: usize) -> Body<'tcx> {
843839
let def = self.source.source.with_opt_param();
844840
let mut rvalue = {
845841
let promoted = &mut self.promoted;
@@ -938,7 +934,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
938934

939935
let span = self.promoted.span;
940936
self.assign(RETURN_PLACE, rvalue, span);
941-
Some(self.promoted)
937+
self.promoted
942938
}
943939
}
944940

@@ -1011,11 +1007,9 @@ pub fn promote_candidates<'tcx>(
10111007
keep_original: false,
10121008
};
10131009

1014-
//FIXME(oli-obk): having a `maybe_push()` method on `IndexVec` might be nice
1015-
if let Some(mut promoted) = promoter.promote_candidate(candidate, promotions.len()) {
1016-
promoted.source.promoted = Some(promotions.next_index());
1017-
promotions.push(promoted);
1018-
}
1010+
let mut promoted = promoter.promote_candidate(candidate, promotions.len());
1011+
promoted.source.promoted = Some(promotions.next_index());
1012+
promotions.push(promoted);
10191013
}
10201014

10211015
// Insert each of `extra_statements` before its indicated location, which

0 commit comments

Comments
 (0)