You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@walkie I wanted to thank you for putting together a great minimal example. It definitely made it a whole lot easier for me as I was working to address this issue. 🤞 the PR review goes smoothly.
Overview
Rustfmt cannot find a submodule of an integration test located in a separate file.
Running
cargo fmt
on a project that contains a submoduletest1/sub1
implemented by the filetests/test1/sub1.rs
produces the following error message:Submodules in integration tests can be created as follows:
In
tests/test1.rs
:The submodules
sub1
andsub2
can be implemented in the filestests/test1/sub1.rs
andtests/test1/sub2.rs
.This structure works with
cargo build
,cargo test
, andcargo clippy
, but fails forcargo fmt
with the error message given above.Steps to reproduce
Clone this repo containing a minimal example illustrating the problem: https://github.com/walkie/rustfmt-test-submodule-issue
From within the repo:
cargo test
and observe that the package successfully compiles and the tests in both submodules run and pass.cargo fmt
and observe the following error message:The same error can also be produced by
rustfmt
directly with the command:rustfmt tests/test1.rs
Expected behavior
Other information
rustup component add rustfmt
1.51
,1.57
, and1.59.0-nightly (48a5999fc 2021-12-01)
The error occurs in all combinations of the above.
The text was updated successfully, but these errors were encountered: