From: Charalampos Mitrodimas <charmitro@posteo.net>
To: Benno Lossin <benno.lossin@proton.me>
Cc: "Masahiro Yamada" <masahiroy@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nicolas@fjasle.eu>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 2/2] rust: enable `too-long-first-doc-paragraph` clippy lint
Date: Sun, 16 Feb 2025 21:46:04 +0000 [thread overview]
Message-ID: <m2jz9p7ecj.fsf@posteo.net> (raw)
In-Reply-To: <20250216213827.3752586-2-benno.lossin@proton.me>
Benno Lossin <benno.lossin@proton.me> writes:
> Introduced in Rust 1.82.0 [1], this lint ensures that the first line of
> documentation is short. That is because those lines get rendered in the
> html version of the docs directly next to the items and should therefore
> be short.
> Additionally, a short first sentence might help developers remember the
> rest of the documentation if they have read it already before.
>
> Reviewers have pointed this out manually on several occasions, thus
> enable the lint.
>
> Here is an example error fixed in the previous commit:
>
> error: first doc comment paragraph is too long
> --> rust/kernel/driver.rs:13:1
> |
> 13 | / /// The [`RegistrationOps`] trait serves as generic interface for subsystems (e.g., PCI, Platform,
> 14 | | /// Amba, etc.) to provide the corresponding subsystem specific implementation to register /
> 15 | | /// unregister a driver of the particular type (`RegType`).
> 16 | | ///
> 17 | | /// For instance, the PCI subsystem would set `RegType` to `bindings::pci_driver` and call
> | |_^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph
> = note: `-D clippy::too-long-first-doc-paragraph` implied by `-D warnings`
> = help: to override `-D warnings` add `#[allow(clippy::too_long_first_doc_paragraph)]`
>
> error: aborting due to 1 previous error
>
> The exact length can be configured in the .clippy.toml if we need to do
> so.
>
> Link: https://github.com/rust-lang/rust-clippy/issues/12989 [1]
> Signed-off-by: Benno Lossin <benno.lossin@proton.me>
> ---
> Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Makefile b/Makefile
> index 9e0d63d9d94b..d00cbeb63714 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -486,6 +486,7 @@ export rust_common_flags := --edition=2021 \
> -Wclippy::undocumented_unsafe_blocks \
> -Wclippy::unnecessary_safety_comment \
> -Wclippy::unnecessary_safety_doc \
> + -Wclippy::too-long-first-doc-paragraph \
> -Wrustdoc::missing_crate_level_docs \
> -Wrustdoc::unescaped_backticks
Reviewed-by: Charalampos Mitrodimas <charmitro@posteo.net>
next prev parent reply other threads:[~2025-02-16 21:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250216213827.3752586-1-benno.lossin@proton.me>
2025-02-16 21:38 ` [PATCH 2/2] rust: enable `too-long-first-doc-paragraph` clippy lint Benno Lossin
2025-02-16 21:46 ` Charalampos Mitrodimas [this message]
2025-02-17 18:07 ` Miguel Ojeda
2025-02-17 22:49 ` Benno Lossin
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=m2jz9p7ecj.fsf@posteo.net \
--to=charmitro@posteo.net \
--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=ojeda@kernel.org \
--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