Description
rustfmt 1.x ran in "recursive" mode by default wherein all the mods within the AST would be visited and formatted, including those mods defined in external files not explicitly passed as args to rustfmt
.
rustfmt 2.x inverts that behavior and will now only format files explicitly passed to rustfmt
unless the --recursive
flag is passed (in which case rustfmt 2.x formats everything like rustfmt 1.x)
As such a few of our test cases needed to be updated to explicitly include the recursive
. Currently these tests are running in "non-recursive" mode and unintentionally ignoring some files which has resulted in a few false positves.
This can be addressed by adding the below snippet to the top of the corresponding pairs of test files under rustfmt-core/rustfmt-lib/tests/{source, target}/**
// rustfmt-recursive: true
Some (perhaps all) of the tests that need this change can be found by reviewing the skipped files in rustfmt-core/rustfmt-lib/src/test/mod.rs
to determine the corresponding entry point files that need recursive
enabled.
rustfmt/rustfmt-core/rustfmt-lib/src/test/mod.rs
Lines 23 to 43 in a0eb97b
For example, we can see there's some test files within the cfg_if
directory (rustfmt-core/rustfmt-lib/tests/{source,target}/cfg_if/mod.rs
that are being explicitly ignored to validate the target behavior, so the entry test file in this case (rustfmt-core/rustfmt-lib/tests/{source,target}/cfg_if/lib.rs
) needs to have recursive mode included by adding // rustfmt-recursive: true
This would be a good first issue for anyone interested in working on rustfmt!