Skip to content

Commit 3e11bd5

Browse files
ojeday86-dev
authored andcommitted
rust: provide proper code documentation titles
Rust 1.82.0's Clippy is introducing [1][2] a new warn-by-default lint, `too_long_first_doc_paragraph` [3], which is intended to catch titles of code documentation items that are too long (likely because no title was provided and the item documentation starts with a paragraph). This lint does not currently trigger anywhere, but it does detect a couple cases if checking for private items gets enabled (which we will do in the next commit): error: first doc comment paragraph is too long --> src/__internal.rs:18:1 | 18 | / /// This is the module-internal type implementing `PinInit` and `Init`. It is unsafe to create this 19 | | /// type, since the closure needs to fulfill the same safety requirement as the 20 | | /// `__pinned_init`/`__init` functions. | |_ | = 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: first doc comment paragraph is too long --> rust/kernel/sync/arc/std_vendor.rs:3:1 | 3 | / //! The contents of this file come from the Rust standard library, hosted in 4 | | //! the <https://github.com/rust-lang/rust> repository, licensed under 5 | | //! "Apache-2.0 OR MIT" and adapted for kernel use. For copyright details, 6 | | //! see <https://github.com/rust-lang/rust/blob/master/COPYRIGHT>. | |_ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph Thus clean those two instances. In addition, since we have a second `std_vendor.rs` file with a similar header, do the same there too (even if that one does not trigger the lint, because it is `doc(hidden)`). Link: rust-lang/rust#129531 [1] Link: rust-lang/rust-clippy#12993 [2] Link: https://rust-lang.github.io/rust-clippy/master/index.html#/too_long_first_doc_paragraph [3] Reviewed-by: Trevor Gross <tmgross@umich.edu> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Tested-by: Gary Guo <gary@garyguo.net> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/20240904204347.168520-15-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org> (cherry picked from commit 2f390cc589433dfcfedc307a141e103929a6fd4d) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 0f35874 commit 3e11bd5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/__internal.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ use super::*;
2323
/// [this table]: https://doc.rust-lang.org/nomicon/phantom-data.html#table-of-phantomdata-patterns
2424
pub(crate) type Invariant<T> = PhantomData<fn(*mut T) -> *mut T>;
2525

26-
/// This is the module-internal type implementing `PinInit` and `Init`. It is unsafe to create this
27-
/// type, since the closure needs to fulfill the same safety requirement as the
28-
/// `__pinned_init`/`__init` functions.
26+
/// Module-internal type implementing `PinInit` and `Init`.
27+
///
28+
/// It is unsafe to create this type, since the closure needs to fulfill the same safety
29+
/// requirement as the `__pinned_init`/`__init` functions.
2930
pub(crate) struct InitClosure<F, T: ?Sized, E>(pub(crate) F, pub(crate) Invariant<(E, T)>);
3031

3132
// SAFETY: While constructing the `InitClosure`, the user promised that it upholds the

0 commit comments

Comments
 (0)