if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r)#108079
if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r)#108079bors merged 1 commit intorust-lang:masterfrom
if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r)#108079Conversation
|
r? @nagisa (rustbot has picked a reviewer for you, use r? to override) |
|
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
| self.session.emit_err(InvalidVisibility { | ||
| span: vis.span, | ||
| implied: if vis.kind.is_pub() { Some(vis.span) } else { None }, | ||
| implied: vis.kind.is_pub().then(|| vis.span), |
There was a problem hiding this comment.
These cases may be simpler as then_some (even if longer 🙃 ). I don't have a strong opinion on then_some usage, beyond it generating less code
|
☀️ Test successful - checks-actions |
|
r+ when doing |
|
This PR's merge into master has been force pushed away since we didn't run tests in practice. Please re-open the PR (as a new PR). |
|
Perhaps rustbot could add the |
…, r=oli-obk
`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`
Resurrection of rust-lang#108079
TL;DR: turn
into
This is part one of many of refactoring compiler to use
.thenwhere it makes code cleaner. This PR does only changes that are simple & clear wins (in my opinion anyway).