Skip to content

Commit cc3d5ce

Browse files
ojedaBennoLossin
authored andcommitted
rust: enable Clippy's check-private-items
In Rust 1.76.0, Clippy added the `check-private-items` lint configuration option. When turned on (the default is off), it makes several lints check private items as well. In our case, it affects two lints we have enabled [1]: `missing_safety_doc` and `unnecessary_safety_doc`. It also seems to affect the new `too_long_first_doc_paragraph` lint [2], even though the documentation does not mention it. Thus allow the few instances remaining we currently hit and enable the lint. Link: https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#check-private-items [1] Link: https://rust-lang.github.io/rust-clippy/master/index.html#/too_long_first_doc_paragraph [2] Reviewed-by: Trevor Gross <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Tested-by: Gary Guo <[email protected]> Reviewed-by: Gary Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]> (cherry picked from commit 624063b9ac97f40cadca32a896aafeb28b1220fd) Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 5cfe7be commit cc3d5ce

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

.clippy.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
3+
check-private-items = true

examples/mutex.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![allow(clippy::undocumented_unsafe_blocks)]
22
#![cfg_attr(feature = "alloc", feature(allocator_api))]
3+
#![allow(clippy::missing_safety_doc)]
34

45
use core::{
56
cell::{Cell, UnsafeCell},

src/__internal.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ where
6161
pub unsafe trait HasPinData {
6262
type PinData: PinData;
6363

64+
#[allow(clippy::missing_safety_doc)]
6465
unsafe fn __pin_data() -> Self::PinData;
6566
}
6667

@@ -90,6 +91,7 @@ pub unsafe trait PinData: Copy {
9091
pub unsafe trait HasInitData {
9192
type InitData: InitData;
9293

94+
#[allow(clippy::missing_safety_doc)]
9395
unsafe fn __init_data() -> Self::InitData;
9496
}
9597

src/macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ macro_rules! __pin_data {
989989
//
990990
// The functions are `unsafe` to prevent accidentally calling them.
991991
#[allow(dead_code)]
992+
#[allow(clippy::missing_safety_doc)]
992993
impl<$($impl_generics)*> $pin_data<$($ty_generics)*>
993994
where $($whr)*
994995
{

0 commit comments

Comments
 (0)