Please write good Rust.
No use of the unsafe
keyword is allowed. This guideline is statically enforced.
All curly brace blocks will have at least one line return between the opening brace and the closing brace. The opening
curly brace of keyword blocks (e.g. impl
) will be placed on the same line as the keyword.
impl Project { pub fn new() -> Project { ... } }
impl Project {
pub fn new() -> Project {
...
}
}
All else
and else if
blocks will begin on the same line as the previous closing curly brace.
if arg.is_present("bin") { ... }
else if arg.is_present("static") { ... }
else { ... }
if arg.is_present("bin") {
...
} else if arg.is_present("static") {
...
} else {
...
}
When y
is a reference, the asterisk operator used to dereference y
should
contain no whitespace between the operator and the reference.
match * y {
...
}
match *y {
...
}
When *y
is a reference the same styling as above should be used.
When importing names from a module, only use the bracket notation when importing multiple names.
use project::{ Project };
use project::Project;
use Foo::{ Bar, Baz };