Skip to content
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

CLI flag --config license_template_path does not override TOML setting #4487

Closed
cmichi opened this issue Oct 22, 2020 · 1 comment
Closed
Labels
bug Panic, non-idempotency, invalid code, etc.

Comments

@cmichi
Copy link
Contributor

cmichi commented Oct 22, 2020

Describe the bug

The flag --config license_template_path="" (or --config=license_template_path="", doesn't matter) does not override the license_template_path from the .rustfmt.toml.

According to --help it should:

        --config [key1=val1,key2=val2...]                                      
                        Set options from command line. These settings take
                        priority over .rustfmt.toml  

To Reproduce

echo 'license_template_path = "FILE_HEADER"' > .rustfmt.toml
echo "// Some license header" > FILE_HEADER 
echo "fn main() {}" > foo.rs

rustfmt --config license_template_path="" foo.rs

For me this then results in the license check still being applied and this error:

error: license check failed
--> /home/michi/projects/rustfmt-bug/foo.rs:1
 |
 |

warning: rustfmt has failed to format. See previous 1 errors.

Expected behavior

The expected behavior is what I get when I don't set any license_template_path in the toml:

$ echo 'license_template_path = ""' > .rustfmt.toml 
$ rustfmt --check foo.rs
$ echo $?
0

Meta

  • rustfmt version: rustfmt 1.4.22-nightly (97d0301 2020-10-04)
  • From where did you install rustfmt? rustup
  • How do you run rustfmt: rustfmt
@cmichi cmichi added the bug Panic, non-idempotency, invalid code, etc. label Oct 22, 2020
@karyon
Copy link
Contributor

karyon commented Oct 26, 2021

Looks like this was fixed in #4488, but wasn't auto-closed.

@karyon karyon closed this as completed Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

No branches or pull requests

2 participants