rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.31k stars 1.53k forks source link

Modules with "test" in name no longer considered test modules #13111

Open jdygert-spok opened 2 months ago

jdygert-spok commented 2 months ago

Description

It seems like an intentional change from #13049. However, it is common in our codebase to have a testing feature that enables test utilities for integration tests or tests in other crates in the workspace. These are no longer excluded from wildcard_imports and some other lints. It would be great to have configuration for this, either checking for the "test" name again or setting a list of features that are included in the cfg check.

Regardless of whether that becomes available, the docs for wildcard_import should be updated: https://github.com/rust-lang/rust-clippy/blob/0ee9f44568b60aaef5d04684cb08f112edd89542/clippy_lints/src/wildcard_imports.rs#L70

Version

No response

Additional Labels

No response

jdygert-spok commented 2 months ago

Benchmarks and integration tests are also not considered tests. Not sure if that's worth a separate issue. Previously this wouldn't really matter, because you would enable lints at the crate root, so they wouldn't apply to those. But setting lints in Cargo.toml means they apply to all targets.

alex-semenyuk commented 1 month ago

@rustbot label I-false-negative