From 481abc136113185840b80355bad58f28a4717515 Mon Sep 17 00:00:00 2001 From: Quang Duong Nguyen Date: Sat, 3 May 2025 14:06:26 -0700 Subject: [PATCH] fix doc --- book/src/lint_configuration.md | 2 +- clippy_config/src/conf.rs | 2 +- clippy_lints/src/missing_doc.rs | 4 ++-- .../missing_docs_allow_unused/missing_docs_allow_unused.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/book/src/lint_configuration.md b/book/src/lint_configuration.md index cc8e362e836c..58c79c119ccf 100644 --- a/book/src/lint_configuration.md +++ b/book/src/lint_configuration.md @@ -735,7 +735,7 @@ Minimum chars an ident can have, anything below or equal to this will be linted. ## `missing-docs-allow-unused` -Whether to allow fields starting with underscore to skip documentation requirements +Whether to allow fields starting with an underscore to skip documentation requirements **Default Value:** `false` diff --git a/clippy_config/src/conf.rs b/clippy_config/src/conf.rs index c1a561aa407d..aef0516b75be 100644 --- a/clippy_config/src/conf.rs +++ b/clippy_config/src/conf.rs @@ -675,7 +675,7 @@ define_Conf! { /// Minimum chars an ident can have, anything below or equal to this will be linted. #[lints(min_ident_chars)] min_ident_chars_threshold: u64 = 1, - /// Whether to allow fields starting with underscore to skip documentation requirements + /// Whether to allow fields starting with an underscore to skip documentation requirements #[lints(missing_docs_in_private_items)] missing_docs_allow_unused: bool = false, /// Whether to **only** check for missing documentation in items visible within the current diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index 5d228f7ea436..1707f9d4fc99 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -48,7 +48,7 @@ pub struct MissingDoc { /// Whether to **only** check for missing documentation in items visible within the current /// crate. For example, `pub(crate)` items. crate_items_only: bool, - /// Whether to allow fields starting with underscore to skip documentation requirements + /// Whether to allow fields starting with an underscore to skip documentation requirements allow_unused: bool, /// Stack of whether #[doc(hidden)] is set /// at each level which has lint attributes. @@ -264,7 +264,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc { fn check_field_def(&mut self, cx: &LateContext<'tcx>, sf: &'tcx hir::FieldDef<'_>) { if !sf.is_positional() { - // Skip checking if the field starts with underscore and allow_unused is enabled + // Skip checking if the field starts with an underscore and allow_unused is enabled if self.allow_unused && sf.ident.as_str().starts_with('_') { self.prev_span = Some(sf.span); return; diff --git a/tests/ui-toml/missing_docs_allow_unused/missing_docs_allow_unused.rs b/tests/ui-toml/missing_docs_allow_unused/missing_docs_allow_unused.rs index bda3fbc928b0..a738ff959fe5 100644 --- a/tests/ui-toml/missing_docs_allow_unused/missing_docs_allow_unused.rs +++ b/tests/ui-toml/missing_docs_allow_unused/missing_docs_allow_unused.rs @@ -6,7 +6,7 @@ struct Test { /// This field is documented field1: i32, - _unused: i32, // This should not trigger a warning because it starts with underscore + _unused: i32, // This should not trigger a warning because it starts with an underscore field3: i32, //~ missing_docs_in_private_items }