1 % Whitespace [FIXME: needs RFC]
3 * Lines must not exceed 99 characters.
4 * Use 4 spaces for indentation, _not_ tabs.
5 * No trailing whitespace at the end of lines or files.
9 * Use spaces around binary operators, including the equals sign in attributes:
12 #[deprecated = "Use `bar` instead."]
13 fn foo(a: usize, b: usize) -> usize {
18 * Use a space after colons and commas:
23 MyStruct { foo: 3, bar: 4 }
28 * Use a space after the opening and before the closing brace for
29 single line blocks or `struct` expressions:
32 spawn(proc() { do_something(); })
34 Point { x: 0.1, y: 0.3 }
39 * For multiline function signatures, each new line should align with the
40 first parameter. Multiple parameters per line are permitted:
43 fn frobnicate(a: Bar, b: Bar,
58 * Multiline function invocations generally follow the same rule as for
59 signatures. However, if the final argument begins a new block, the
60 contents of the block may begin on a new line, indented one level:
63 fn foo_bar(a: Bar, b: Bar,
69 foo_bar(x, y, |z| { z.transpose(y) });
71 // Indented body on new line is also fine:
78 > **[FIXME]** Do we also want to allow the following?
87 > This style could ease the conflict between line length and functions
88 > with many parameters (or long method chains).
92 > * **[Deprecated]** If you have multiple patterns in a single `match`
93 > arm, write each pattern on a separate line:
109 Idiomatic code should not use extra whitespace in the middle of a line
110 to provide alignment.