File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -407,20 +407,28 @@ 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 ///
416+ /// Same goes for misspelling `test`.
417+ ///
414418 /// ### Example
415419 /// ```no_run
416420 /// #[cfg(features = "some-feature")]
417421 /// fn conditional() { }
422+ /// #[cfg(tests)]
423+ /// mod tests { }
418424 /// ```
419425 ///
420426 /// Use instead:
421427 /// ```no_run
422428 /// #[cfg(feature = "some-feature")]
423429 /// fn conditional() { }
430+ /// #[cfg(test)]
431+ /// mod tests { }
424432 /// ```
425433 #[ clippy:: version = "1.69.0" ]
426434 pub MAYBE_MISUSED_CFG ,
You can’t perform that action at this time.
0 commit comments