Skip to content

Commit 95d4253

Browse files
authored
Unrolled build for rust-lang#140764
Rollup merge of rust-lang#140764 - joshtriplett:style-nullary-functions, r=traviscross style: Never break within a nullary function call `func()` or a unit literal `()` Implements rust-lang/style-team#210
2 parents 7e552b4 + 38e3fa6 commit 95d4253

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ edition).
2626
Not all Rust editions have corresponding changes to the Rust style. For
2727
instance, Rust 2015, Rust 2018, and Rust 2021 all use the same style edition.
2828

29+
## Rust next style edition
30+
31+
- Never break within a nullary function call `func()` or a unit literal `()`.
32+
2933
## Rust 2024 style edition
3034

3135
This style guide describes the Rust 2024 style edition. The Rust 2024 style

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

+9
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ let f = Foo {
183183
};
184184
```
185185

186+
## Unit literals
187+
188+
Never break between the opening and closing parentheses of the `()` unit literal.
189+
186190
## Tuple literals
187191

188192
Use a single-line form where possible. Do not put spaces between the opening
@@ -377,6 +381,11 @@ Do put a space between an argument, and the comma which precedes it.
377381

378382
Prefer not to break a line in the callee expression.
379383

384+
For a function call with no arguments (a nullary function call like `func()`),
385+
never break within the parentheses, and never put a space between the
386+
parentheses. Always write a nullary function call as a single-line call, never
387+
a multi-line call.
388+
380389
### Single-line calls
381390

382391
Do not put a space between the function name and open paren, between the open

0 commit comments

Comments
 (0)