-
Notifications
You must be signed in to change notification settings - Fork 961
Description
What I tried:
(1) rustfmt --print-config minimal .rustfmt.toml
(2) rustfmt --print-config minimal .rustfmt.toml src/lib.rs
What I expected:
Invocation (1) should have produced a minimal configuration in .rustfmt.toml based on settings from the current directory, without formatting anything.
Invocation (2) should have done something similar, but only incorporating src/lib.rs.
What actually happened:
The PATH following --print-config minimal is both the path to the minimal config and the file to run rustfmt on. So, the first complains the file doesn't exist; if it exists, it tries to format it and throws a syntax error. The second is the exact same, with an extra ignored argument.
Looking at the code, I think this feature is implemented, but the command line isn't parsed correctly; --print-config minimal needs to consume an additional argument which is just the path to the new config. If it were parsed correctly, the behavior would be surprising, since it would both format the code and print a config (when I would expect --print-config to not modify the source code).
Also, note that there are no tests for either --print-config default or --print-config minimal.