Closed
Description
Sometimes, I want to run rustfmt on all source files in a directory. There is a *
wildcard that can be used but it also tries to format toml
and any other files in the directory.
I think, There should be a *.rs
wildcard that formats all Rust source files in the specified directory and also any rust files in the subdirectories of specified directory.
Activity
ishanjain28 commentedon Feb 11, 2018
On a second thought, Formatting all
.rs
files in a directory and it's subdirectories might cause performance issues and there might be someone who doesn't wants to format all the source files in subdirectories.So, A
-r --recursive
flag is probably a good idea.ishanjain28 commentedon Feb 11, 2018
Oh, Just found out about the
--skip-children
option. It automatically formats all imported modules in the file. My issue is now resolved but-r --recursive
and*.rs
wildcard might be useful for someone who has different/unrelated .rs files in a directory.nrc commentedon Feb 11, 2018
Rustfmt formats programs rather than files. If you format lib.rs/main.rs, it will format all files in the library/application.
Remove TODOs from README.md
AlexAegis commentedon Dec 8, 2019
And how about workspaces?
Would be nice to just pass a glob like so:
rustfmt src/**/*.rs