From 24534cffe60044965d3cd11d49e9b568c3dfa865 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Wed, 5 Jul 2023 15:33:21 -0700 Subject: style-guide: Fix chain example to match rustfmt behavior The style guide gave an example of breaking a multi-line chain element and all subsequent elements to a new line, but that same example and the accompanying text also had several chain items stacked on the first line. rustfmt doesn't do this, except when the rule saying to combine ``` shrt .y() ``` into ``` shrt.y() ``` applies. --- src/doc/style-guide/src/expressions.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/doc') diff --git a/src/doc/style-guide/src/expressions.md b/src/doc/style-guide/src/expressions.md index f5e37b6c46f..fda3b8e8209 100644 --- a/src/doc/style-guide/src/expressions.md +++ b/src/doc/style-guide/src/expressions.md @@ -450,12 +450,11 @@ foo( #### Multi-line elements -If any element in a chain is formatted across multiple lines, then that element -and any later elements must be on their own line. Earlier elements may be kept -on a single line. E.g., +If any element in a chain is formatted across multiple lines, put that element +and any later elements on their own lines. ```rust -a.b.c()?.d +a.b.c()? .foo( an_expr, another_expr, -- cgit 1.4.1-3-g733a5 From ddd5fd1e3cff5e0f1971fb8ba545804ac96652f5 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Wed, 5 Jul 2023 15:56:13 -0700 Subject: style-guide: Expand example of combinable expressions to include arrays Arrays are allowed as combinable expressions, but none of the examples show that. --- src/doc/style-guide/src/expressions.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/doc') diff --git a/src/doc/style-guide/src/expressions.md b/src/doc/style-guide/src/expressions.md index f5e37b6c46f..5b07a27c8fc 100644 --- a/src/doc/style-guide/src/expressions.md +++ b/src/doc/style-guide/src/expressions.md @@ -801,6 +801,16 @@ foo(|param| { action(); foo(param) }) + +let x = combinable([ + an_expr, + another_expr, +]); + +let arr = [combinable( + an_expr, + another_expr, +)]; ``` Such behaviour should extend recursively, however, tools may choose to limit the -- cgit 1.4.1-3-g733a5 From b706cf80b037982ba2d0d72771ae1d479a1ecfaf Mon Sep 17 00:00:00 2001 From: rustbot <47979223+rustbot@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:16:29 -0400 Subject: Update books --- src/doc/book | 2 +- src/doc/edition-guide | 2 +- src/doc/embedded-book | 2 +- src/doc/nomicon | 2 +- src/doc/reference | 2 +- src/doc/rust-by-example | 2 +- src/doc/rustc-dev-guide | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/doc') diff --git a/src/doc/book b/src/doc/book index 21cf840842b..668c64760b5 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 21cf840842bdf768a798869f06373c96c1cc5122 +Subproject commit 668c64760b5c7ea654facb4ba5fe9faddfda27cc diff --git a/src/doc/edition-guide b/src/doc/edition-guide index f63e578b92f..2751bdcef12 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit f63e578b92ff43e8cc38fcaa257b660f45c8a8c2 +Subproject commit 2751bdcef125468ea2ee006c11992cd1405aebe5 diff --git a/src/doc/embedded-book b/src/doc/embedded-book index f2aed2fe8e9..1e5556dd1b8 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit f2aed2fe8e9f55508c86ba3aa4b6789b18a08a22 +Subproject commit 1e5556dd1b864109985d5871616ae6b9164bcead diff --git a/src/doc/nomicon b/src/doc/nomicon index c369e4b4893..302b995bcb2 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit c369e4b489332f8721fbae630354fa83385d457d +Subproject commit 302b995bcb24b70fd883980fd174738c3a10b705 diff --git a/src/doc/reference b/src/doc/reference index 5ca365eac67..1ea0178266b 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 5ca365eac678cb0d41a20b3204546d6ed70c7171 +Subproject commit 1ea0178266b3f3f613b0fabdaf16a83961c99cdb diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 57636d69267..8a87926a985 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 57636d6926762861f34e030d52ca25a71e95e5bf +Subproject commit 8a87926a985ce32ca1fad1be4008ee161a0b91eb diff --git a/src/doc/rustc-dev-guide b/src/doc/rustc-dev-guide index 17fe3e94849..b5a12d95e32 160000 --- a/src/doc/rustc-dev-guide +++ b/src/doc/rustc-dev-guide @@ -1 +1 @@ -Subproject commit 17fe3e948498c50e208047a750f17d6a8d89669b +Subproject commit b5a12d95e32ae53791cc6ab44417774667ed2ac6 -- cgit 1.4.1-3-g733a5