rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Ojeda <ojeda@kernel.org>
To: Miguel Ojeda <ojeda@kernel.org>, Alex Gaynor <alex.gaynor@gmail.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev, "Masahiro Yamada" <masahiroy@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nicolas@fjasle.eu>,
	linux-kbuild@vger.kernel.org
Subject: [RFC PATCH 10/10] rust: kbuild: enable `doc_markdown` Clippy lint
Date: Mon, 24 Mar 2025 22:03:57 +0100	[thread overview]
Message-ID: <20250324210359.1199574-11-ojeda@kernel.org> (raw)
In-Reply-To: <20250324210359.1199574-1-ojeda@kernel.org>

Clippy supports the `doc_markdown` lint [1] since 2016 [2]:

    Checks for the presence of _, :: or camel-case words outside ticks
    in documentation.

It is a very common note in Linux kernel reviews to mention that
documentation is missing a Markdown code span, e.g.:

    /// Length of the data must be less than data_size.

should have been:

    /// Length of the data must be less than `data_size`.

This lint can identify some of those cases automatically for us.

It also caught for us other typos or mis-documentation, such as a missing
code block.

Thus enable it, now that the tree is sufficiently clean.

Relatedly, it would be nice to have something similar [3] even for
comments (not just documentation), as well as for possible intra-doc links
(which should also have less false positives).

Link: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown [1]
Link: https://github.com/rust-lang/rust-clippy/commit/42bf37f49f49829507be4f2dfd6c5db9b8234b66 [2]
Link: https://github.com/rust-lang/rust/issues/131510 [3]
Link: https://lore.kernel.org/rust-for-linux/CANiq72=aVRMvOaU48DBLL=p+VoG3RvHK+K48XQhvHw3ARc0BNg@mail.gmail.com/
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
 .clippy.toml | 4 ++++
 Makefile     | 1 +
 2 files changed, 5 insertions(+)

diff --git a/.clippy.toml b/.clippy.toml
index 815c94732ed7..adc32c88176c 100644
--- a/.clippy.toml
+++ b/.clippy.toml
@@ -9,3 +9,7 @@ disallowed-macros = [
     # it here, see: https://github.com/rust-lang/rust-clippy/issues/11303.
     { path = "kernel::dbg", reason = "the `dbg!` macro is intended as a debugging tool" },
 ]
+
+doc-valid-idents = [
+    "KUnit",
+]
diff --git a/Makefile b/Makefile
index 70bdbf2218fc..5d6baedc097f 100644
--- a/Makefile
+++ b/Makefile
@@ -477,6 +477,7 @@ export rust_common_flags := --edition=2021 \
 			    -Wrust_2018_idioms \
 			    -Wunreachable_pub \
 			    -Wclippy::all \
+			    -Wclippy::doc_markdown \
 			    -Wclippy::ignored_unit_patterns \
 			    -Wclippy::mut_mut \
 			    -Wclippy::needless_bitwise_bool \
--
2.49.0

  parent reply	other threads:[~2025-03-24 21:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24 21:03 [PATCH 00/10] rust: clean and enable Clippy `doc_markdown` lint Miguel Ojeda
2025-03-24 21:03 ` [PATCH 01/10] drm/panic: add missing space Miguel Ojeda
2025-03-25  9:02   ` Jocelyn Falempe
2025-03-24 21:03 ` [PATCH 02/10] drm/panic: add missing Markdown code span Miguel Ojeda
2025-03-25  9:05   ` Jocelyn Falempe
2025-03-25 19:04     ` Miguel Ojeda
2025-03-27 15:22       ` Jocelyn Falempe
2025-03-24 21:03 ` [PATCH 03/10] rust: alloc: add missing Markdown code spans Miguel Ojeda
2025-03-24 21:03 ` [PATCH 04/10] rust: alloc: add missing Markdown code span Miguel Ojeda
2025-03-24 21:03 ` [PATCH 05/10] rust: dma: " Miguel Ojeda
2025-03-24 21:03 ` [PATCH 06/10] rust: of: " Miguel Ojeda
2025-03-24 21:03 ` [PATCH 07/10] rust: pci: fix docs related to missing Markdown code spans Miguel Ojeda
2025-03-24 22:53   ` Benno Lossin
2025-03-24 23:01     ` Miguel Ojeda
2025-03-24 21:03 ` [PATCH 08/10] rust: platform: " Miguel Ojeda
2025-03-24 21:03 ` [PATCH 09/10] rust: task: add missing Markdown code spans and intra-doc links Miguel Ojeda
2025-03-24 21:03 ` Miguel Ojeda [this message]
2025-03-24 22:59 ` [PATCH 00/10] rust: clean and enable Clippy `doc_markdown` lint Benno Lossin
2025-03-24 23:09   ` Miguel Ojeda
2025-03-25  0:17     ` Benno Lossin
2025-05-21 14:01 ` Miguel Ojeda
2025-05-21 15:09   ` Greg Kroah-Hartman
2025-05-24 14:18   ` Danilo Krummrich
2025-05-25 21:20 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250324210359.1199574-11-ojeda@kernel.org \
    --to=ojeda@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=patches@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).