Skip to content

Commit f08037c

Browse files
Update documentation for MAYBE_MISUSED_CFG lint
1 parent a621d71 commit f08037c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clippy_lints/src/attrs.rs

+7-1
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)