-
Notifications
You must be signed in to change notification settings - Fork 925
--print-config minimal doesn't work as advertised #2758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I want to add that it seems to work with the |
To confirm the desired behavior. Given a default
|
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 runrustfmt
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
.The text was updated successfully, but these errors were encountered: