Rollup merge of #110426 - calebcartwright:style-let-else-examples, r=compiler-errors
docs(style): add more let-else examples Adding a few more examples for increased clarity based on subsequent discussion that arose after implementation work began. Will need approval from t-style, but also cc ```@ytmimi``` to make sure these examples don't contradict any examples we've been incorporating as part of the rustfmt implementation
This commit is contained in:
commit
c2a79fb490
@ -138,6 +138,7 @@ Otherwise, the `else` keyword and opening brace should be placed on the next lin
|
||||
For example:
|
||||
|
||||
```rust
|
||||
fn main() {
|
||||
let Some(x) = abcdef()
|
||||
.foo(
|
||||
"abc",
|
||||
@ -149,7 +150,19 @@ let Some(x) = abcdef()
|
||||
.baz()
|
||||
.qux("fffffffffffffffff")
|
||||
else {
|
||||
foo_bar()
|
||||
return
|
||||
};
|
||||
|
||||
let Some(x) = some_really_really_really_really_really_really_really_really_really_long_name
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
let Some(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) =
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
else {
|
||||
return;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user