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:
Matthias Krüger 2023-04-27 15:10:52 +02:00 committed by GitHub
commit c2a79fb490
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
};
}
```