Skip to content

Commit e8fc7ba

Browse files
committed
Slap #[inline] on all the ByRefSized methods, per the8472's suggestion
1 parent 83595f9 commit e8fc7ba

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

library/core/src/iter/adapters/by_ref_sized.rs

+11
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,35 @@ pub(crate) struct ByRefSized<'a, I>(pub &'a mut I);
99
impl<I: Iterator> Iterator for ByRefSized<'_, I> {
1010
type Item = I::Item;
1111

12+
#[inline]
1213
fn next(&mut self) -> Option<Self::Item> {
1314
self.0.next()
1415
}
1516

17+
#[inline]
1618
fn size_hint(&self) -> (usize, Option<usize>) {
1719
self.0.size_hint()
1820
}
1921

22+
#[inline]
2023
fn advance_by(&mut self, n: usize) -> Result<(), usize> {
2124
self.0.advance_by(n)
2225
}
2326

27+
#[inline]
2428
fn nth(&mut self, n: usize) -> Option<Self::Item> {
2529
self.0.nth(n)
2630
}
2731

32+
#[inline]
2833
fn fold<B, F>(self, init: B, f: F) -> B
2934
where
3035
F: FnMut(B, Self::Item) -> B,
3136
{
3237
self.0.fold(init, f)
3338
}
3439

40+
#[inline]
3541
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
3642
where
3743
F: FnMut(B, Self::Item) -> R,
@@ -42,25 +48,30 @@ impl<I: Iterator> Iterator for ByRefSized<'_, I> {
4248
}
4349

4450
impl<I: DoubleEndedIterator> DoubleEndedIterator for ByRefSized<'_, I> {
51+
#[inline]
4552
fn next_back(&mut self) -> Option<Self::Item> {
4653
self.0.next_back()
4754
}
4855

56+
#[inline]
4957
fn advance_back_by(&mut self, n: usize) -> Result<(), usize> {
5058
self.0.advance_back_by(n)
5159
}
5260

61+
#[inline]
5362
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
5463
self.0.nth_back(n)
5564
}
5665

66+
#[inline]
5767
fn rfold<B, F>(self, init: B, f: F) -> B
5868
where
5969
F: FnMut(B, Self::Item) -> B,
6070
{
6171
self.0.rfold(init, f)
6272
}
6373

74+
#[inline]
6475
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
6576
where
6677
F: FnMut(B, Self::Item) -> R,

0 commit comments

Comments
 (0)