Closed
Description
Summary
#10992 fixed some of the interaction between the items-after-test-module
lint and the test-case
crate by ignoring proc macros. That works, but it still gets confused if you have non-test-case
tests after test-case
tests in the same file.
Lint Name
items-after-test-module
Reproducer
I tried this code:
use test_case::test_case;
#[test_case(1)]
#[test_case(2)]
fn test_the_thing(n: usize) {
assert!(n < 5);
}
#[test]
fn other_test() {
assert!(5 < 6);
}
I saw this happen:
warning: items were found after the testing module
--> tests/stuff.rs:3:1
|
3 | #[test_case(1)]
| ^--------------
| |
| _in this procedural macro expansion
| |
4 | | #[test_case(2)]
5 | | fn test_the_thing(n: usize) {
6 | | assert!(n < 5);
... |
11 | | assert!(5 < 6);
12 | | }
| |_^
|
= help: move the items to before the testing module was defined
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_test_module
= note: `-W clippy::items-after-test-module` implied by `-W clippy::all`
= note: this warning originates in the attribute macro `test_case` (in Nightly builds, run with -Z macro-backtrace for more info)
Version
rustc 1.71.0 (8ede3aae2 2023-07-12)
binary: rustc
commit-hash: 8ede3aae28fe6e4d52b38157d7bfe0d3bceef225
commit-date: 2023-07-12
host: aarch64-apple-darwin
release: 1.71.0
LLVM version: 16.0.5
Additional Labels
No response