about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-05-07 20:31:47 +0100
committerJosh Triplett <josh@joshtriplett.org>2025-05-07 20:36:06 +0100
commit38e3fa61f634e37ca99f7d91b770d38886c9e813 (patch)
treecdc806784f0488fa16b33f034d5ad604de17019b
parent3ef8e64ce9f72ee8d600d55bc43b36eed069b252 (diff)
downloadrust-38e3fa61f634e37ca99f7d91b770d38886c9e813.tar.gz
rust-38e3fa61f634e37ca99f7d91b770d38886c9e813.zip
style: Never break within a nullary function call `func()` or a unit literal `()`
-rw-r--r--src/doc/style-guide/src/editions.md4
-rw-r--r--src/doc/style-guide/src/expressions.md9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/doc/style-guide/src/editions.md b/src/doc/style-guide/src/editions.md
index 19e62c4867c..81b7ff50052 100644
--- a/src/doc/style-guide/src/editions.md
+++ b/src/doc/style-guide/src/editions.md
@@ -26,6 +26,10 @@ edition).
 Not all Rust editions have corresponding changes to the Rust style. For
 instance, Rust 2015, Rust 2018, and Rust 2021 all use the same style edition.
 
+## Rust next style edition
+
+- Never break within a nullary function call `func()` or a unit literal `()`.
+
 ## Rust 2024 style edition
 
 This style guide describes the Rust 2024 style edition. The Rust 2024 style
diff --git a/src/doc/style-guide/src/expressions.md b/src/doc/style-guide/src/expressions.md
index 031e59d86e1..9df5d7d18ed 100644
--- a/src/doc/style-guide/src/expressions.md
+++ b/src/doc/style-guide/src/expressions.md
@@ -183,6 +183,10 @@ let f = Foo {
 };
 ```
 
+## Unit literals
+
+Never break between the opening and closing parentheses of the `()` unit literal.
+
 ## Tuple literals
 
 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.
 
 Prefer not to break a line in the callee expression.
 
+For a function call with no arguments (a nullary function call like `func()`),
+never break within the parentheses, and never put a space between the
+parentheses. Always write a nullary function call as a single-line call, never
+a multi-line call.
+
 ### Single-line calls
 
 Do not put a space between the function name and open paren, between the open