Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style-guide: Some cleanups from the fmt-rfcs repo history #113392

Merged
merged 6 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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