-
Notifications
You must be signed in to change notification settings - Fork 883
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
Rustfmt cannot resolve submodules of integration tests #5119
Comments
As a workaround, you can tell Rustfmt to skip the submodules when formatting the entire package:
This will enable
|
@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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:/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: