Open
Description
Summary
tests_outside_test_module
can be triggered in integration tests.
This actually came up because I was trying out RFC 3389 manifest-lint
which helpfully applies lint configuration to all integration tests. manifest-lint
isn't required to trigger the issue, though.
Applying the suggestion given by the lint does work (i.e. still runs the test and silences the warning), but is redundant since it's already in an integration test.
Lint Name
tests_outside_test_module
Reproducer
I tried this code in tests/integrations/main.rs
:
#![warn(clippy::tests_outside_test_module)]
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
I saw this happen when running cargo clippy --tests
:
warning: this function marked with #[test] is outside a #[cfg(test)] module
--> tests/integrations/main.rs:4:1
|
4 | / fn it_works() {
5 | | assert_eq!(2 + 2, 4);
6 | | }
| |_^
|
= note: move it to a testing module marked with #[cfg(test)]
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tests_outside_test_module
note: the lint level is defined here
--> tests/integrations/main.rs:1:9
|
1 | #![warn(clippy::tests_outside_test_module)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I expected to see no warnings generated.
Version
rustc 1.70.0 (90c541806 2023-05-31)
binary: rustc
commit-hash: 90c541806f23a127002de5b4038be731ba1458ca
commit-date: 2023-05-31
host: x86_64-unknown-linux-gnu
release: 1.70.0
LLVM version: 16.0.2
Additional Labels
No response