about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-27 13:38:19 +0000
committerbors <bors@rust-lang.org>2023-04-27 13:38:19 +0000
commit901fdb3b04375e3456b5cf771f86ecca8d6c1917 (patch)
treec839aa495a143234447b43187b00bfa2e019aa3c /src
parent6ce22733b973355573efd1e6294e585460e90e17 (diff)
parent52d550b20ee1a327565b2002ac7f02243d0fa12e (diff)
downloadrust-901fdb3b04375e3456b5cf771f86ecca8d6c1917.tar.gz
rust-901fdb3b04375e3456b5cf771f86ecca8d6c1917.zip
Auto merge of #110896 - matthiaskrgr:rollup-h8fetzd, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #110426 (docs(style): add more let-else examples)
 - #110804 (Remove repeated definite articles)
 - #110814 (Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr`)
 - #110816 (Migrate `rustc_passes` to translatable diagnostics)
 - #110864 (`IntoFuture::into_future` is no longer unstable)
 - #110866 (Make `method-not-found-generic-arg-elision.rs` error message not path dependent)
 - #110872 (Nicer ICE for #67981)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/doc/style-guide/src/statements.md37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/doc/style-guide/src/statements.md b/src/doc/style-guide/src/statements.md
index 4ab1c36f976..671e6d31a57 100644
--- a/src/doc/style-guide/src/statements.md
+++ b/src/doc/style-guide/src/statements.md
@@ -138,18 +138,31 @@ Otherwise, the `else` keyword and opening brace should be placed on the next lin
 For example:
 
 ```rust
-let Some(x) = abcdef()
-    .foo(
-        "abc",
-        some_really_really_really_long_ident,
-        "ident",
-        "123456",
-    )
-    .bar()
-    .baz()
-    .qux("fffffffffffffffff")
-else {
-    foo_bar()
+fn main() {
+    let Some(x) = abcdef()
+        .foo(
+            "abc",
+            some_really_really_really_long_ident,
+            "ident",
+            "123456",
+        )
+        .bar()
+        .baz()
+        .qux("fffffffffffffffff")
+    else {
+        return
+    };
+
+    let Some(x) = some_really_really_really_really_really_really_really_really_really_long_name
+    else {
+        return;
+    };
+
+    let Some(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) =
+        bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+    else {
+        return;
+    };
 }
 ```