...

/

Line Wrapping and Alignment

Line Wrapping and Alignment

Line wrapping

For multiline function signatures, each new line should align with the first parameter. Multiple parameters per line are permitted:

fn frobnicate(a: Bar, b: Bar,
              c: Bar, d: Bar)
              -> Bar {
    ...
}

Alignment

The idiomatic code i.e., having a key-value pair should not use extra whitespace in the middle of a line to provide alignment.

// Good
struct Foo {
    short: f64,
    really_long: f64,
}

// Bad
struct Bar {
    short:       f64,
    really_long: f64,
}

// Good
let a = 0;
let radius = 7;

// Bad
let b        = 0;
let diameter = 7;