Open
Description
$ printf '\n\n\nmod test;' | rustfmt +nightly --unstable-features --file-lines []
mod test;
$ printf ' mod test;' | rustfmt +nightly --unstable-features --file-lines []
mod test;
$ printf '//! ' | rustfmt +nightly --unstable-features --file-lines [] | tr ' ' .
//!
$ printf '' | rustfmt +nightly --unstable-features --file-lines [] | tr $'\n' X
X
$ printf 'fn f(){} // what' | rustfmt +nightly --unstable-features --file-lines []
fn f(){}// what
Note that:
- intial newlines are removed
- initial whitespace is removed
- the space after the doc comment is removed
- a newline at the end of the file is added
- a space before a comment is lost in certain cases
Why this is a problem
file-lines is meant to restrict the reformatting to specific sets of lines. Whitespace changes elsewhere are therefore undesirable.