Closed
Description
Decide on the options and defaults for the maximum width of lines and indents.
Rustfmt currently has the following options:
max_width: usize, 100, "Maximum width of each line";
ideal_width: usize, 80, "Ideal width of each line";
tab_spaces: usize, 4, "Number of spaces per tab";
hard_tabs: bool, false, "Use tab characters for indentation, spaces for alignment";
The style guide specifies a maximum line width of 99 chars and 4 spaces (no tabs) for indentation. make tidy
enforces 100 char width for the Rust repo.
Mostly these defaults seem reasonable. Points to discuss:
- 99 or 100 char width,
- 'ideal width' concept,
- which options should remain,
- names of options.
Notes:
- ideal width is not really used by rustfmt any more, in retrospect it was a bad idea. The only place it is used (I think) is for comments. I do think wrapping comments at 80 chars is nice, since reading prose is easier in narrower columns and the solid text of large comment blocks looks bad. It might be nice to keep the comment width at 80 and either remove the option to change it, or rename the option.
- the 99 chars thing is to cope with diffs in 100 chars or newlines in terminals.