Skip to content

Commit 1e6c09a

Browse files
committed
Auto merge of #113392 - joshtriplett:style-guide-cleanups, r=compiler-errors
style-guide: Some cleanups from the fmt-rfcs repo history There were a few commits that seem to have gone missing between the fmt-rfcs repo and the style guide. Re-apply those commits to the version of the style-guide in `rust-lang/rust`. All of these are cleanups that don't change meaning.
2 parents c06b2b9 + 9ea1180 commit 1e6c09a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/doc/style-guide/src/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ options.
3737
### Indentation and line width
3838

3939
* Use spaces, not tabs.
40-
* Each level of indentation must be four spaces (that is, all indentation
41-
outside of string literals and comments must be a multiple of four).
40+
* Each level of indentation must be 4 spaces (that is, all indentation
41+
outside of string literals and comments must be a multiple of 4).
4242
* The maximum width for a line is 100 characters.
4343

4444
#### Block indent

src/doc/style-guide/src/expressions.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ Write an empty block as `{}`.
6464
Write a block on a single line if:
6565

6666
* it is either used in expression position (not statement position) or is an
67-
unsafe block in statement position
68-
* it contains a single-line expression and no statements
67+
unsafe block in statement position,
68+
* it contains a single-line expression and no statements, and
6969
* it contains no comments
7070

7171
For a single-line block, put spaces after the opening brace and before the
@@ -125,9 +125,9 @@ expression of the closure. Between the `|`s, use function definition syntax,
125125
but elide types where possible.
126126

127127
Use closures without the enclosing `{}`, if possible. Add the `{}` when you have
128-
a return type, when there are statements, there are comments in the body, or the
129-
body expression spans multiple lines and is a control-flow expression. If using
130-
braces, follow the rules above for blocks. Examples:
128+
a return type, when there are statements, when there are comments inside the
129+
closure, or when the body expression is a control-flow expression that spans
130+
multiple lines. If using braces, follow the rules above for blocks. Examples:
131131

132132
```rust
133133
|arg1, arg2| expr
@@ -178,10 +178,12 @@ let f = Foo {
178178
Functional record update syntax is treated like a field, but it must never have
179179
a trailing comma. Do not put a space after `..`.
180180

181+
```rust
181182
let f = Foo {
182183
field1,
183184
..an_expr
184185
};
186+
```
185187

186188

187189
### Tuple literals

0 commit comments

Comments
 (0)