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.
This commit is contained in:
bors 2023-07-21 13:16:52 +00:00
commit 1e6c09a803
2 changed files with 9 additions and 7 deletions

View File

@ -37,8 +37,8 @@ options.
### Indentation and line width ### Indentation and line width
* Use spaces, not tabs. * Use spaces, not tabs.
* Each level of indentation must be four spaces (that is, all indentation * Each level of indentation must be 4 spaces (that is, all indentation
outside of string literals and comments must be a multiple of four). outside of string literals and comments must be a multiple of 4).
* The maximum width for a line is 100 characters. * The maximum width for a line is 100 characters.
#### Block indent #### Block indent

View File

@ -64,8 +64,8 @@ Write an empty block as `{}`.
Write a block on a single line if: Write a block on a single line if:
* it is either used in expression position (not statement position) or is an * it is either used in expression position (not statement position) or is an
unsafe block in statement position unsafe block in statement position,
* it contains a single-line expression and no statements * it contains a single-line expression and no statements, and
* it contains no comments * it contains no comments
For a single-line block, put spaces after the opening brace and before the 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,
but elide types where possible. but elide types where possible.
Use closures without the enclosing `{}`, if possible. Add the `{}` when you have Use closures without the enclosing `{}`, if possible. Add the `{}` when you have
a return type, when there are statements, there are comments in the body, or the a return type, when there are statements, when there are comments inside the
body expression spans multiple lines and is a control-flow expression. If using closure, or when the body expression is a control-flow expression that spans
braces, follow the rules above for blocks. Examples: multiple lines. If using braces, follow the rules above for blocks. Examples:
```rust ```rust
|arg1, arg2| expr |arg1, arg2| expr
@ -178,10 +178,12 @@ let f = Foo {
Functional record update syntax is treated like a field, but it must never have Functional record update syntax is treated like a field, but it must never have
a trailing comma. Do not put a space after `..`. a trailing comma. Do not put a space after `..`.
```rust
let f = Foo { let f = Foo {
field1, field1,
..an_expr ..an_expr
}; };
```
### Tuple literals ### Tuple literals