Skip to content

Commit b659370

Browse files
committed
inline inner function of inlining methods
1 parent 53d5261 commit b659370

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

library/core/src/slice/iter.rs

+19
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ unsafe impl<T: Sync> Sync for Iter<'_, T> {}
8282
unsafe impl<T: Sync> Send for Iter<'_, T> {}
8383

8484
impl<'a, T> Iter<'a, T> {
85+
#[inline]
8586
pub(super) fn new(slice: &'a [T]) -> Self {
8687
let ptr = slice.as_ptr();
8788
// SAFETY: Similar to `IterMut::new`.
@@ -200,6 +201,7 @@ unsafe impl<T: Sync> Sync for IterMut<'_, T> {}
200201
unsafe impl<T: Send> Send for IterMut<'_, T> {}
201202

202203
impl<'a, T> IterMut<'a, T> {
204+
#[inline]
203205
pub(super) fn new(slice: &'a mut [T]) -> Self {
204206
let ptr = slice.as_mut_ptr();
205207
// SAFETY: There are several things here:
@@ -330,6 +332,7 @@ where
330332
}
331333

332334
impl<'a, T: 'a, P: FnMut(&T) -> bool> Split<'a, T, P> {
335+
#[inline]
333336
pub(super) fn new(slice: &'a [T], pred: P) -> Self {
334337
Self { v: slice, pred, finished: false }
335338
}
@@ -974,6 +977,7 @@ where
974977
}
975978

976979
impl<'a, T: 'a, P: FnMut(&T) -> bool> SplitN<'a, T, P> {
980+
#[inline]
977981
pub(super) fn new(s: Split<'a, T, P>, n: usize) -> Self {
978982
Self { inner: GenericSplitN { iter: s, count: n } }
979983
}
@@ -1006,6 +1010,7 @@ where
10061010
}
10071011

10081012
impl<'a, T: 'a, P: FnMut(&T) -> bool> RSplitN<'a, T, P> {
1013+
#[inline]
10091014
pub(super) fn new(s: RSplit<'a, T, P>, n: usize) -> Self {
10101015
Self { inner: GenericSplitN { iter: s, count: n } }
10111016
}
@@ -1037,6 +1042,7 @@ where
10371042
}
10381043

10391044
impl<'a, T: 'a, P: FnMut(&T) -> bool> SplitNMut<'a, T, P> {
1045+
#[inline]
10401046
pub(super) fn new(s: SplitMut<'a, T, P>, n: usize) -> Self {
10411047
Self { inner: GenericSplitN { iter: s, count: n } }
10421048
}
@@ -1069,6 +1075,7 @@ where
10691075
}
10701076

10711077
impl<'a, T: 'a, P: FnMut(&T) -> bool> RSplitNMut<'a, T, P> {
1078+
#[inline]
10721079
pub(super) fn new(s: RSplitMut<'a, T, P>, n: usize) -> Self {
10731080
Self { inner: GenericSplitN { iter: s, count: n } }
10741081
}
@@ -1103,6 +1110,7 @@ pub struct Windows<'a, T: 'a> {
11031110
}
11041111

11051112
impl<'a, T: 'a> Windows<'a, T> {
1113+
#[inline]
11061114
pub(super) fn new(slice: &'a [T], size: usize) -> Self {
11071115
Self { v: slice, size }
11081116
}
@@ -1241,6 +1249,7 @@ pub struct Chunks<'a, T: 'a> {
12411249
}
12421250

12431251
impl<'a, T: 'a> Chunks<'a, T> {
1252+
#[inline]
12441253
pub(super) fn new(slice: &'a [T], size: usize) -> Self {
12451254
Self { v: slice, chunk_size: size }
12461255
}
@@ -1401,6 +1410,7 @@ pub struct ChunksMut<'a, T: 'a> {
14011410
}
14021411

14031412
impl<'a, T: 'a> ChunksMut<'a, T> {
1413+
#[inline]
14041414
pub(super) fn new(slice: &'a mut [T], size: usize) -> Self {
14051415
Self { v: slice, chunk_size: size }
14061416
}
@@ -1561,6 +1571,7 @@ pub struct ChunksExact<'a, T: 'a> {
15611571
}
15621572

15631573
impl<'a, T> ChunksExact<'a, T> {
1574+
#[inline]
15641575
pub(super) fn new(slice: &'a [T], chunk_size: usize) -> Self {
15651576
let rem = slice.len() % chunk_size;
15661577
let fst_len = slice.len() - rem;
@@ -1709,6 +1720,7 @@ pub struct ChunksExactMut<'a, T: 'a> {
17091720
}
17101721

17111722
impl<'a, T> ChunksExactMut<'a, T> {
1723+
#[inline]
17121724
pub(super) fn new(slice: &'a mut [T], chunk_size: usize) -> Self {
17131725
let rem = slice.len() % chunk_size;
17141726
let fst_len = slice.len() - rem;
@@ -1849,6 +1861,7 @@ pub struct ArrayWindows<'a, T: 'a, const N: usize> {
18491861
}
18501862

18511863
impl<'a, T: 'a, const N: usize> ArrayWindows<'a, T, N> {
1864+
#[inline]
18521865
pub(super) fn new(slice: &'a [T]) -> Self {
18531866
let num_windows = slice.len().saturating_sub(N - 1);
18541867
Self { slice_head: slice.as_ptr(), num: num_windows, marker: PhantomData }
@@ -1960,6 +1973,7 @@ pub struct ArrayChunks<'a, T: 'a, const N: usize> {
19601973
}
19611974

19621975
impl<'a, T, const N: usize> ArrayChunks<'a, T, N> {
1976+
#[inline]
19631977
pub(super) fn new(slice: &'a [T]) -> Self {
19641978
let len = slice.len() / N;
19651979
let (fst, snd) = slice.split_at(len * N);
@@ -2077,6 +2091,7 @@ pub struct ArrayChunksMut<'a, T: 'a, const N: usize> {
20772091
}
20782092

20792093
impl<'a, T, const N: usize> ArrayChunksMut<'a, T, N> {
2094+
#[inline]
20802095
pub(super) fn new(slice: &'a mut [T]) -> Self {
20812096
let len = slice.len() / N;
20822097
let (fst, snd) = slice.split_at_mut(len * N);
@@ -2185,6 +2200,7 @@ pub struct RChunks<'a, T: 'a> {
21852200
}
21862201

21872202
impl<'a, T: 'a> RChunks<'a, T> {
2203+
#[inline]
21882204
pub(super) fn new(slice: &'a [T], size: usize) -> Self {
21892205
Self { v: slice, chunk_size: size }
21902206
}
@@ -2341,6 +2357,7 @@ pub struct RChunksMut<'a, T: 'a> {
23412357
}
23422358

23432359
impl<'a, T: 'a> RChunksMut<'a, T> {
2360+
#[inline]
23442361
pub(super) fn new(slice: &'a mut [T], size: usize) -> Self {
23452362
Self { v: slice, chunk_size: size }
23462363
}
@@ -2498,6 +2515,7 @@ pub struct RChunksExact<'a, T: 'a> {
24982515
}
24992516

25002517
impl<'a, T> RChunksExact<'a, T> {
2518+
#[inline]
25012519
pub(super) fn new(slice: &'a [T], chunk_size: usize) -> Self {
25022520
let rem = slice.len() % chunk_size;
25032521
// SAFETY: 0 <= rem <= slice.len() by construction above
@@ -2650,6 +2668,7 @@ pub struct RChunksExactMut<'a, T: 'a> {
26502668
}
26512669

26522670
impl<'a, T> RChunksExactMut<'a, T> {
2671+
#[inline]
26532672
pub(super) fn new(slice: &'a mut [T], chunk_size: usize) -> Self {
26542673
let rem = slice.len() % chunk_size;
26552674
// SAFETY: 0 <= rem <= slice.len() by construction above

0 commit comments

Comments
 (0)