Skip to content

Commit 6169d49

Browse files
committed
Locally suppress Clippy's missing-safety-doc lint for traits which are not implementable downstream.
1 parent 89460c0 commit 6169d49

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/data_traits.rs

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use crate::{ArrayBase, CowRepr, Dimension, OwnedArcRepr, OwnedRepr, RawViewRepr,
2727
/// ***Note:*** `RawData` is not an extension interface at this point.
2828
/// Traits in Rust can serve many different roles. This trait is public because
2929
/// it is used as a bound on public methods.
30+
#[allow(clippy::missing_safety_doc)] // not implementable downstream
3031
pub unsafe trait RawData: Sized {
3132
/// The array element type.
3233
type Elem;
@@ -47,6 +48,7 @@ pub unsafe trait RawData: Sized {
4748
/// For an array with writable elements.
4849
///
4950
/// ***Internal trait, see `RawData`.***
51+
#[allow(clippy::missing_safety_doc)] // not implementable downstream
5052
pub unsafe trait RawDataMut: RawData {
5153
/// If possible, ensures that the array has unique access to its data.
5254
///
@@ -74,6 +76,7 @@ pub unsafe trait RawDataMut: RawData {
7476
/// An array representation that can be cloned.
7577
///
7678
/// ***Internal trait, see `RawData`.***
79+
#[allow(clippy::missing_safety_doc)] // not implementable downstream
7780
pub unsafe trait RawDataClone: RawData {
7881
#[doc(hidden)]
7982
/// Unsafe because, `ptr` must point inside the current storage.
@@ -96,6 +99,7 @@ pub unsafe trait RawDataClone: RawData {
9699
/// For an array with elements that can be accessed with safe code.
97100
///
98101
/// ***Internal trait, see `RawData`.***
102+
#[allow(clippy::missing_safety_doc)] // not implementable downstream
99103
pub unsafe trait Data: RawData {
100104
/// Converts the array to a uniquely owned array, cloning elements if necessary.
101105
#[doc(hidden)]
@@ -131,6 +135,7 @@ pub unsafe trait Data: RawData {
131135
// `RawDataMut::try_ensure_unique` implementation always panics or ensures that
132136
// the data is unique. You are also guaranteeing that `try_is_unique` always
133137
// returns `Some(_)`.
138+
#[allow(clippy::missing_safety_doc)] // not implementable downstream
134139
pub unsafe trait DataMut: Data + RawDataMut {
135140
/// Ensures that the array has unique access to its data.
136141
#[doc(hidden)]
@@ -449,6 +454,7 @@ unsafe impl<'a, A> DataMut for ViewRepr<&'a mut A> {}
449454
// The array storage must be initially mutable - copy on write arrays may require copying for
450455
// unsharing storage before mutating it. The initially allocated storage must be mutable so
451456
// that it can be mutated directly - through .raw_view_mut_unchecked() - for initialization.
457+
#[allow(clippy::missing_safety_doc)] // not implementable downstream
452458
pub unsafe trait DataOwned: Data {
453459
/// Corresponding owned data with MaybeUninit elements
454460
type MaybeUninit: DataOwned<Elem = MaybeUninit<Self::Elem>>
@@ -467,6 +473,7 @@ pub unsafe trait DataOwned: Data {
467473
/// A representation that is a lightweight view.
468474
///
469475
/// ***Internal trait, see `Data`.***
476+
#[allow(clippy::missing_safety_doc)] // not implementable downstream
470477
pub unsafe trait DataShared: Clone + Data + RawDataClone {}
471478

472479
unsafe impl<A> DataShared for OwnedArcRepr<A> {}

src/iterators/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,7 @@ send_sync_read_write!(ElementsBaseMut);
14451445
///
14461446
/// The iterator must produce exactly the number of elements it reported or
14471447
/// diverge before reaching the end.
1448+
#[allow(clippy::missing_safety_doc)] // not nameable downstream
14481449
pub unsafe trait TrustedIterator {}
14491450

14501451
use crate::indexes::IndicesIterF;

src/slice.rs

+1
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ impl From<NewAxis> for SliceInfoElem {
295295
/// that `D`, `Self::OutDim`, `self.in_dim()`, and `self.out_ndim()` are
296296
/// consistent with the `&[SliceInfoElem]` returned by `self.as_ref()` and that
297297
/// `self.as_ref()` always returns the same value when called multiple times.
298+
#[allow(clippy::missing_safety_doc)] // not implementable downstream
298299
pub unsafe trait SliceArg<D: Dimension>: AsRef<[SliceInfoElem]> {
299300
/// Dimensionality of the output array.
300301
type OutDim: Dimension;

0 commit comments

Comments
 (0)