-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Labels
Description
Currently Rustfmt treats certain items differently if they are 'short'. For example, it will but a short struct literal on one line:
// Short
let x = Foo { x: 42 };
// Not short
let opts = Options {
flag_package: vec![],
flag_jobs: None,
flag_features: vec![],
flag_all_features: false,
flag_no_default_features: false,
};
As @joshtriplett points out in #31 (comment), we should have one global definition of 'short' rather than a different definition every time.
I see two ways to define 'short' - absolute characters (e.g., 25) or proportion of max line length (e.g., 1/4). One might argue that no matter how long the line length, what makes (e.g.) a struct literal readable on one line does not change. On the other hand, people who prefer longer lines might also prefer more on one line in these cases.