Skip to content

Commit 3747d7f

Browse files
committed
style-guide: Move text about block vs visual indent to indentation section
`principles.md` includes some high-level guiding principles for formatting, but also includes a few specific formatting provisions. While those provisions apply in many places, the same holds true for other high-level guidance, such as the indentation section. Move the text about using block indent rather than visual indent to the indentation section, so that `principles.md` can focus on guiding principles while the top level of the style guide gives concrete formatting recommendations.
1 parent 2efe091 commit 3747d7f

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ typically by using a formatting tool's default settings.
3030
* The maximum width for a line is 100 characters.
3131
* A tool should be configurable for all three of these variables.
3232

33+
#### Block indent
34+
35+
Prefer block indent over visual indent:
36+
37+
```rust
38+
// Block indent
39+
a_function_call(
40+
foo,
41+
bar,
42+
);
43+
44+
// Visual indent
45+
a_function_call(foo,
46+
bar);
47+
```
48+
49+
This makes for smaller diffs (e.g., if `a_function_call` is renamed in the above
50+
example) and less rightward drift.
3351

3452
### Blank lines
3553

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ following principles (in rough priority order):
3131

3232
## Overarching guidelines
3333

34-
Prefer block indent over visual indent. E.g.,
35-
36-
```rust
37-
// Block indent
38-
a_function_call(
39-
foo,
40-
bar,
41-
);
42-
43-
// Visual indent
44-
a_function_call(foo,
45-
bar);
46-
```
47-
48-
This makes for smaller diffs (e.g., if `a_function_call` is renamed in the above
49-
example) and less rightward drift.
50-
5134
Lists should have a trailing comma when followed by a newline, see the block
5235
indent example above. This choice makes moving code (e.g., by copy and paste)
5336
easier and makes smaller diffs.

0 commit comments

Comments
 (0)