Skip to content

Commit

Permalink
Auto merge of rust-lang#113392 - joshtriplett:style-guide-cleanups, r…
Browse files Browse the repository at this point in the history
…=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.
  • Loading branch information
bors committed Jul 21, 2023
2 parents c06b2b9 + 9ea1180 commit 1e6c09a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/doc/style-guide/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ options.
### Indentation and line width

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

#### Block indent
Expand Down
12 changes: 7 additions & 5 deletions src/doc/style-guide/src/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Write an empty block as `{}`.
Write a block on a single line if:

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

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

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
body expression spans multiple lines and is a control-flow expression. If using
braces, follow the rules above for blocks. Examples:
a return type, when there are statements, when there are comments inside the
closure, or when the body expression is a control-flow expression that spans
multiple lines. If using braces, follow the rules above for blocks. Examples:

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

```rust
let f = Foo {
field1,
..an_expr
};
```


### Tuple literals
Expand Down

0 comments on commit 1e6c09a

Please sign in to comment.