Closed
Description
Should we put spaces around the equal sign (=
) in attributes? For example, should we write
#![recursion_limit="1024"]
or
#![recursion_limit = "1024"]
?
Notes:
- rustfmt does not seem to care about this. It keeps whatever amount of whitespace I use. However, when I write
let x=1;
, it corrects that tolet x = 1;
. - The Rust Reference uses both styles, even inside of a single code block:
#![crate_type = "lib"]
// ...
#[cfg(target_os="linux")]
- There is no example code for this in the examples part of this repo.
- I was unable to find this piece of information in the Attributes section of the guide. Does the following rule also apply to attributes?
Do include spaces around binary ops (i.e., x + 1, not x+1) (including =).
If so, then maybe we should add this to the Attributes section of the guide (including an example) to prevent confusion and add a formatting rule to rustfmt
.