File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -407,20 +407,26 @@ declare_clippy_lint! {
407407 /// Checks for `#[cfg(features = "...")]` and suggests to replace it with
408408 /// `#[cfg(feature = "...")]`.
409409 ///
410+ /// It also checks if `cfg(test)` was misspelled.
411+ ///
410412 /// ### Why is this bad?
411- /// Misspelling `feature` as `features` can be sometimes hard to spot. It
413+ /// Misspelling `feature` as `features` or `test` as `tests` can be sometimes hard to spot. It
412414 /// may cause conditional compilation not work quietly.
413415 ///
414416 /// ### Example
415417 /// ```no_run
416418 /// #[cfg(features = "some-feature")]
417419 /// fn conditional() { }
420+ /// #[cfg(tests)]
421+ /// mod tests { }
418422 /// ```
419423 ///
420424 /// Use instead:
421425 /// ```no_run
422426 /// #[cfg(feature = "some-feature")]
423427 /// fn conditional() { }
428+ /// #[cfg(test)]
429+ /// mod tests { }
424430 /// ```
425431 #[ clippy:: version = "1.69.0" ]
426432 pub MAYBE_MISUSED_CFG ,
You can’t perform that action at this time.
0 commit comments