* [PATCH 1/2] rust: fix clippy::too-long-first-doc-paragraph
@ 2025-02-16 21:38 Benno Lossin
2025-02-16 21:38 ` [PATCH 2/2] rust: enable `too-long-first-doc-paragraph` clippy lint Benno Lossin
0 siblings, 1 reply; 5+ messages in thread
From: Benno Lossin @ 2025-02-16 21:38 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Wedson Almeida Filho
Cc: rust-for-linux, linux-kernel
Before enabling the `too-long-first-doc-paragraph` clippy lint, fix the
only violation by prepending a short, single line description.
Fixes: ea7e18289f44 ("rust: implement generic driver registration")
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
---
rust/kernel/driver.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs
index 2a16d5e64e6c..65c9c1776556 100644
--- a/rust/kernel/driver.rs
+++ b/rust/kernel/driver.rs
@@ -10,6 +10,8 @@
use core::pin::Pin;
use macros::{pin_data, pinned_drop};
+/// Generic interface for subsystem driver registrations.
+///
/// The [`RegistrationOps`] trait serves as generic interface for subsystems (e.g., PCI, Platform,
/// Amba, etc.) to provide the corresponding subsystem specific implementation to register /
/// unregister a driver of the particular type (`RegType`).
base-commit: beeb78d46249cab8b2b8359a2ce8fa5376b5ad2d
--
2.47.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] rust: enable `too-long-first-doc-paragraph` clippy lint
2025-02-16 21:38 [PATCH 1/2] rust: fix clippy::too-long-first-doc-paragraph Benno Lossin
@ 2025-02-16 21:38 ` Benno Lossin
2025-02-16 21:46 ` Charalampos Mitrodimas
2025-02-17 18:07 ` Miguel Ojeda
0 siblings, 2 replies; 5+ messages in thread
From: Benno Lossin @ 2025-02-16 21:38 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich
Cc: linux-kbuild, linux-kernel, rust-for-linux
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
--
2.47.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] rust: enable `too-long-first-doc-paragraph` clippy lint
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
2025-02-17 18:07 ` Miguel Ojeda
1 sibling, 0 replies; 5+ messages in thread
From: Charalampos Mitrodimas @ 2025-02-16 21:46 UTC (permalink / raw)
To: Benno Lossin
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
linux-kbuild, linux-kernel, rust-for-linux
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] rust: enable `too-long-first-doc-paragraph` clippy lint
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
@ 2025-02-17 18:07 ` Miguel Ojeda
2025-02-17 22:49 ` Benno Lossin
1 sibling, 1 reply; 5+ messages in thread
From: Miguel Ojeda @ 2025-02-17 18:07 UTC (permalink / raw)
To: Benno Lossin
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
linux-kbuild, linux-kernel, rust-for-linux
On Sun, Feb 16, 2025 at 10:38 PM Benno Lossin <benno.lossin@proton.me> wrote:
>
> Introduced in Rust 1.82.0 [1], this lint ensures that the first line of
We will need to ignore unknown lints so that it does not warn on older
compilers.
We should probably do it conditionally instead -- it requires some
rework to do it for everything, but we can easily do it for kernel code.
I can tweak it and put this patch into my warning rework series -- I
had to send the v2 of that anyway. Sounds good?
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] rust: enable `too-long-first-doc-paragraph` clippy lint
2025-02-17 18:07 ` Miguel Ojeda
@ 2025-02-17 22:49 ` Benno Lossin
0 siblings, 0 replies; 5+ messages in thread
From: Benno Lossin @ 2025-02-17 22:49 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
linux-kbuild, linux-kernel, rust-for-linux
On 17.02.25 19:07, Miguel Ojeda wrote:
> On Sun, Feb 16, 2025 at 10:38 PM Benno Lossin <benno.lossin@proton.me> wrote:
>>
>> Introduced in Rust 1.82.0 [1], this lint ensures that the first line of
>
> We will need to ignore unknown lints so that it does not warn on older
> compilers.
>
> We should probably do it conditionally instead -- it requires some
> rework to do it for everything, but we can easily do it for kernel code.
Ah yeah forgot about that. That's a good point.
> I can tweak it and put this patch into my warning rework series -- I
> had to send the v2 of that anyway. Sounds good?
Sure!
---
Cheers,
Benno
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-02-17 22:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-16 21:38 [PATCH 1/2] rust: fix clippy::too-long-first-doc-paragraph Benno Lossin
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
2025-02-17 18:07 ` Miguel Ojeda
2025-02-17 22:49 ` Benno Lossin
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).