Skip to content

Commit 68f649a

Browse files
committed
FIX: Make internal iterator types and functions pub(crate)
These `pub` here actually predate the pub(crate) feature, and they should just be `pub(crate)` or lower since they are unreachable outside the crate.
1 parent 6c8b821 commit 68f649a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/iterators/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::slice::{self, Iter as SliceIter, IterMut as SliceIterMut};
3434
/// Base for iterators over all axes.
3535
///
3636
/// Iterator element type is `*mut A`.
37-
pub struct Baseiter<A, D> {
37+
pub(crate) struct Baseiter<A, D> {
3838
ptr: *mut A,
3939
dim: D,
4040
strides: D,
@@ -321,7 +321,7 @@ pub struct Iter<'a, A, D> {
321321
}
322322

323323
/// Counted read only iterator
324-
pub struct ElementsBase<'a, A, D> {
324+
pub(crate) struct ElementsBase<'a, A, D> {
325325
inner: Baseiter<A, D>,
326326
life: PhantomData<&'a A>,
327327
}
@@ -338,7 +338,7 @@ pub struct IterMut<'a, A, D> {
338338
/// An iterator over the elements of an array.
339339
///
340340
/// Iterator element type is `&'a mut A`.
341-
pub struct ElementsBaseMut<'a, A, D> {
341+
pub(crate) struct ElementsBaseMut<'a, A, D> {
342342
inner: Baseiter<A, D>,
343343
life: PhantomData<&'a mut A>,
344344
}
@@ -767,7 +767,7 @@ where
767767
}
768768

769769
#[derive(Debug)]
770-
pub struct AxisIterCore<A, D> {
770+
struct AxisIterCore<A, D> {
771771
/// Index along the axis of the value of `.next()`, relative to the start
772772
/// of the axis.
773773
index: Ix,
@@ -1445,8 +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
1449-
pub unsafe trait TrustedIterator {}
1448+
pub(crate) unsafe trait TrustedIterator {}
14501449

14511450
use crate::indexes::IndicesIterF;
14521451
use crate::iter::IndicesIter;
@@ -1471,15 +1470,15 @@ unsafe impl<D> TrustedIterator for IndicesIterF<D> where D: Dimension {}
14711470
unsafe impl<A, D> TrustedIterator for IntoIter<A, D> where D: Dimension {}
14721471

14731472
/// Like Iterator::collect, but only for trusted length iterators
1474-
pub fn to_vec<I>(iter: I) -> Vec<I::Item>
1473+
pub(crate) fn to_vec<I>(iter: I) -> Vec<I::Item>
14751474
where
14761475
I: TrustedIterator + ExactSizeIterator,
14771476
{
14781477
to_vec_mapped(iter, |x| x)
14791478
}
14801479

14811480
/// Like Iterator::collect, but only for trusted length iterators
1482-
pub fn to_vec_mapped<I, F, B>(iter: I, mut f: F) -> Vec<B>
1481+
pub(crate) fn to_vec_mapped<I, F, B>(iter: I, mut f: F) -> Vec<B>
14831482
where
14841483
I: TrustedIterator + ExactSizeIterator,
14851484
F: FnMut(I::Item) -> B,

0 commit comments

Comments
 (0)