Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0776a4b

Browse files
calebcartwrightcompiler-errors
andcommitted
docs(style): add more let-else examples
Co-authored-by: Michael Goulet <michael@errs.io>
1 parent c609da5 commit 0776a4b

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

‎src/doc/style-guide/src/statements.md‎

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,31 @@ Otherwise, the `else` keyword and opening brace should be placed on the next lin
138138
For example:
139139

140140
```rust
141-
let Some(x) = abcdef()
142-
.foo(
143-
"abc",
144-
some_really_really_really_long_ident,
145-
"ident",
146-
"123456",
147-
)
148-
.bar()
149-
.baz()
150-
.qux("fffffffffffffffff")
151-
else {
152-
foo_bar()
141+
fn main() {
142+
let Some(x) = abcdef()
143+
.foo(
144+
"abc",
145+
some_really_really_really_long_ident,
146+
"ident",
147+
"123456",
148+
)
149+
.bar()
150+
.baz()
151+
.qux("fffffffffffffffff")
152+
else {
153+
return
154+
};
155+
156+
let Some(x) = some_really_really_really_really_really_really_really_really_really_long_name
157+
else {
158+
return;
159+
};
160+
161+
let Some(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) =
162+
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
163+
else {
164+
return;
165+
};
153166
}
154167
```
155168

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /