Closed
Description
Description
An easy misspelling to make is to write something like:
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(tests)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
This will not result in any warnings or errors currently, but will simply not run any of the tests. Clippy should instead output a warning:
warning: test may misspelled as tests
--> src/lib.rs:5:7
|
5 | #[cfg(tests)]
| ^^^^^ help: use: `test`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/
index.html#maybe_misused_cfg
= note: `#[warn(clippy::maybe_misused_cfg)]` on by default
Version
rustc 1.71.0 (8ede3aae2 2023-07-12)
binary: rustc
commit-hash: 8ede3aae28fe6e4d52b38157d7bfe0d3bceef225
commit-date: 2023-07-12
host: x86_64-unknown-linux-gnu
release: 1.71.0
LLVM version: 16.0.5
Additional Labels
@rustbot label +C-enhancement