Commit f8dae0c
authored
Rollup merge of #116481 - scottmcm:tweak-combinators, r=cuviper
Reuse existing `Some`s in `Option::(x)or`
LLVM still has trouble re-using discriminants sometimes when rebuilding a two-variant enum, so when we have the correct variant already built, just use it.
That's shorter in the Rust code, as well as simpler in MIR and the optimized LLVM, so might as well: <https://rust.godbolt.org/z/KhdE8eToW>
Thanks to `@veber-alex` for pointing out this opportunity in #101210 (comment)1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1475 | 1475 | | |
1476 | 1476 | | |
1477 | 1477 | | |
1478 | | - | |
| 1478 | + | |
1479 | 1479 | | |
1480 | 1480 | | |
1481 | 1481 | | |
| |||
1500 | 1500 | | |
1501 | 1501 | | |
1502 | 1502 | | |
1503 | | - | |
| 1503 | + | |
1504 | 1504 | | |
1505 | 1505 | | |
1506 | 1506 | | |
| |||
1530 | 1530 | | |
1531 | 1531 | | |
1532 | 1532 | | |
1533 | | - | |
1534 | | - | |
| 1533 | + | |
| 1534 | + | |
1535 | 1535 | | |
1536 | 1536 | | |
1537 | 1537 | | |
| |||
0 commit comments