rustfmt
rustfmt copied to clipboard
Recursive `--config-path` doesn't recurse
trafficstars
Describe the bug
The --config-path help description says:
--config-path [Path for the configuration file]
Recursively searches the given path for the
rustfmt.toml config file. If not found reverts to the
input file path
However it doesn't seem to recurse:
$ rustfmt --config-path ~/Downloads/test_issue/my_crate/src/main.rs --edition 2018 < ~/Downloads/test_issue/my_crate/src/main.rs
Could not parse TOML: expected an equals, found an identifier at line 1 column 4
$ rustfmt --config-path ~/Downloads/test_issue/my_crate/src/ --edition 2018 < ~/Downloads/test_issue/my_crate/src/main.rs
Error: unable to find a config file for the given path: `~/Downloads/test_issue/my_crate/src/`
$ rustfmt --config-path ~/Downloads/test_issue/my_crate/src --edition 2018 < ~/Downloads/test_issue/my_crate/src/main.rs
Error: unable to find a config file for the given path: `~/Downloads/test_issue/my_crate/src`
$ rustfmt --config-path ~/Downloads/test_issue/my_crate --edition 2018 < ~/Downloads/test_issue/my_crate/src/main.rs
fn fjsdlkfjklsdajflksdjlfdasdsadsadsaadkjdskljflkasj_jflksjdklfjsdlkjflkdjslkfjas(a: i32, b: i32, c: i32) {
println!("TEST");
}
fn main() {
fjsdlkfjklsdajflksdjlfdasdsadsadsaadkjdskljflkasj_jflksjdklfjsdlkjflkdjslkfjas(1, 2, 3);
println!("Hello, world!");
}
$ rustfmt --config-path ~/Downloads/test_issue/ --edition 2018 < ~/Downloads/test_issue/my_crate/src/main.rs
Error: unable to find a config file for the given path: `~/Downloads/test_issue/`
To Reproduce
Test project is the one from https://github.com/rust-analyzer/rust-analyzer/issues/6973#issuecomment-762881775
Expected behavior
rustfmt --config-path follows the same logic as rustfmt
Meta
- rustfmt version:
rustfmt 1.4.32-nightly (216a643 2021-01-16) - From where did you install rustfmt?:
rustup - How do you run rustfmt:
rustfmt