Skip to content

Commit 8a22bc3

Browse files
committedMay 22, 2019
Revert "Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators."
This reverts commit 3e86cf3.
1 parent 37ff5d3 commit 8a22bc3

File tree

14 files changed

+0
-159
lines changed

14 files changed

+0
-159
lines changed
 

Diff for: ‎src/liballoc/collections/binary_heap.rs

-15
Original file line numberDiff line numberDiff line change
@@ -1035,11 +1035,6 @@ impl<'a, T> Iterator for Iter<'a, T> {
10351035
fn size_hint(&self) -> (usize, Option<usize>) {
10361036
self.iter.size_hint()
10371037
}
1038-
1039-
#[inline]
1040-
fn last(mut self) -> Option<&'a T> {
1041-
self.next_back()
1042-
}
10431038
}
10441039

10451040
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1095,11 +1090,6 @@ impl<T> Iterator for IntoIter<T> {
10951090
fn size_hint(&self) -> (usize, Option<usize>) {
10961091
self.iter.size_hint()
10971092
}
1098-
1099-
#[inline]
1100-
fn last(mut self) -> Option<T> {
1101-
self.next_back()
1102-
}
11031093
}
11041094

11051095
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1146,11 +1136,6 @@ impl<T> Iterator for Drain<'_, T> {
11461136
fn size_hint(&self) -> (usize, Option<usize>) {
11471137
self.iter.size_hint()
11481138
}
1149-
1150-
#[inline]
1151-
fn last(mut self) -> Option<T> {
1152-
self.next_back()
1153-
}
11541139
}
11551140

11561141
#[stable(feature = "drain", since = "1.6.0")]

Diff for: ‎src/liballoc/collections/btree/map.rs

-40
Original file line numberDiff line numberDiff line change
@@ -1193,11 +1193,6 @@ impl<'a, K: 'a, V: 'a> Iterator for Iter<'a, K, V> {
11931193
fn size_hint(&self) -> (usize, Option<usize>) {
11941194
(self.length, Some(self.length))
11951195
}
1196-
1197-
#[inline]
1198-
fn last(mut self) -> Option<(&'a K, &'a V)> {
1199-
self.next_back()
1200-
}
12011196
}
12021197

12031198
#[stable(feature = "fused", since = "1.26.0")]
@@ -1258,11 +1253,6 @@ impl<'a, K: 'a, V: 'a> Iterator for IterMut<'a, K, V> {
12581253
fn size_hint(&self) -> (usize, Option<usize>) {
12591254
(self.length, Some(self.length))
12601255
}
1261-
1262-
#[inline]
1263-
fn last(mut self) -> Option<(&'a K, &'a mut V)> {
1264-
self.next_back()
1265-
}
12661256
}
12671257

12681258
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1369,11 +1359,6 @@ impl<K, V> Iterator for IntoIter<K, V> {
13691359
fn size_hint(&self) -> (usize, Option<usize>) {
13701360
(self.length, Some(self.length))
13711361
}
1372-
1373-
#[inline]
1374-
fn last(mut self) -> Option<(K, V)> {
1375-
self.next_back()
1376-
}
13771362
}
13781363

13791364
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1436,11 +1421,6 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
14361421
fn size_hint(&self) -> (usize, Option<usize>) {
14371422
self.inner.size_hint()
14381423
}
1439-
1440-
#[inline]
1441-
fn last(mut self) -> Option<&'a K> {
1442-
self.next_back()
1443-
}
14441424
}
14451425

14461426
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1478,11 +1458,6 @@ impl<'a, K, V> Iterator for Values<'a, K, V> {
14781458
fn size_hint(&self) -> (usize, Option<usize>) {
14791459
self.inner.size_hint()
14801460
}
1481-
1482-
#[inline]
1483-
fn last(mut self) -> Option<&'a V> {
1484-
self.next_back()
1485-
}
14861461
}
14871462

14881463
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1520,11 +1495,6 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
15201495
unsafe { Some(self.next_unchecked()) }
15211496
}
15221497
}
1523-
1524-
#[inline]
1525-
fn last(mut self) -> Option<(&'a K, &'a V)> {
1526-
self.next_back()
1527-
}
15281498
}
15291499

15301500
#[stable(feature = "map_values_mut", since = "1.10.0")]
@@ -1538,11 +1508,6 @@ impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
15381508
fn size_hint(&self) -> (usize, Option<usize>) {
15391509
self.inner.size_hint()
15401510
}
1541-
1542-
#[inline]
1543-
fn last(mut self) -> Option<&'a mut V> {
1544-
self.next_back()
1545-
}
15461511
}
15471512

15481513
#[stable(feature = "map_values_mut", since = "1.10.0")]
@@ -1661,11 +1626,6 @@ impl<'a, K, V> Iterator for RangeMut<'a, K, V> {
16611626
unsafe { Some(self.next_unchecked()) }
16621627
}
16631628
}
1664-
1665-
#[inline]
1666-
fn last(mut self) -> Option<(&'a K, &'a mut V)> {
1667-
self.next_back()
1668-
}
16691629
}
16701630

16711631
impl<'a, K, V> RangeMut<'a, K, V> {

Diff for: ‎src/liballoc/collections/btree/set.rs

-15
Original file line numberDiff line numberDiff line change
@@ -1019,11 +1019,6 @@ impl<'a, T> Iterator for Iter<'a, T> {
10191019
fn size_hint(&self) -> (usize, Option<usize>) {
10201020
self.iter.size_hint()
10211021
}
1022-
1023-
#[inline]
1024-
fn last(mut self) -> Option<&'a T> {
1025-
self.next_back()
1026-
}
10271022
}
10281023
#[stable(feature = "rust1", since = "1.0.0")]
10291024
impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
@@ -1049,11 +1044,6 @@ impl<T> Iterator for IntoIter<T> {
10491044
fn size_hint(&self) -> (usize, Option<usize>) {
10501045
self.iter.size_hint()
10511046
}
1052-
1053-
#[inline]
1054-
fn last(mut self) -> Option<T> {
1055-
self.next_back()
1056-
}
10571047
}
10581048
#[stable(feature = "rust1", since = "1.0.0")]
10591049
impl<T> DoubleEndedIterator for IntoIter<T> {
@@ -1083,11 +1073,6 @@ impl<'a, T> Iterator for Range<'a, T> {
10831073
fn next(&mut self) -> Option<&'a T> {
10841074
self.iter.next().map(|(k, _)| k)
10851075
}
1086-
1087-
#[inline]
1088-
fn last(mut self) -> Option<&'a T> {
1089-
self.next_back()
1090-
}
10911076
}
10921077

10931078
#[stable(feature = "btree_range", since = "1.17.0")]

Diff for: ‎src/liballoc/string.rs

-4
Original file line numberDiff line numberDiff line change
@@ -2385,10 +2385,6 @@ impl Iterator for Drain<'_> {
23852385
fn size_hint(&self) -> (usize, Option<usize>) {
23862386
self.iter.size_hint()
23872387
}
2388-
#[inline]
2389-
fn last(mut self) -> Option<char> {
2390-
self.next_back()
2391-
}
23922388
}
23932389

23942390
#[stable(feature = "drain", since = "1.6.0")]

Diff for: ‎src/liballoc/vec.rs

-14
Original file line numberDiff line numberDiff line change
@@ -2395,11 +2395,6 @@ impl<T> Iterator for IntoIter<T> {
23952395
fn count(self) -> usize {
23962396
self.len()
23972397
}
2398-
2399-
#[inline]
2400-
fn last(mut self) -> Option<T> {
2401-
self.next_back()
2402-
}
24032398
}
24042399

24052400
#[stable(feature = "rust1", since = "1.0.0")]
@@ -2519,11 +2514,6 @@ impl<T> Iterator for Drain<'_, T> {
25192514
fn size_hint(&self) -> (usize, Option<usize>) {
25202515
self.iter.size_hint()
25212516
}
2522-
2523-
#[inline]
2524-
fn last(mut self) -> Option<T> {
2525-
self.next_back()
2526-
}
25272517
}
25282518

25292519
#[stable(feature = "drain", since = "1.6.0")]
@@ -2593,10 +2583,6 @@ impl<I: Iterator> Iterator for Splice<'_, I> {
25932583
fn size_hint(&self) -> (usize, Option<usize>) {
25942584
self.drain.size_hint()
25952585
}
2596-
2597-
fn last(mut self) -> Option<Self::Item> {
2598-
self.next_back()
2599-
}
26002586
}
26012587

26022588
#[stable(feature = "vec_splice", since = "1.21.0")]

Diff for: ‎src/libcore/ascii.rs

-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ impl Iterator for EscapeDefault {
117117
type Item = u8;
118118
fn next(&mut self) -> Option<u8> { self.range.next().map(|i| self.data[i]) }
119119
fn size_hint(&self) -> (usize, Option<usize>) { self.range.size_hint() }
120-
#[inline]
121-
fn last(mut self) -> Option<u8> { self.next_back() }
122120
}
123121
#[stable(feature = "rust1", since = "1.0.0")]
124122
impl DoubleEndedIterator for EscapeDefault {

Diff for: ‎src/libcore/iter/adapters/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
7373
{
7474
self.iter.position(predicate)
7575
}
76-
77-
#[inline]
78-
fn last(mut self) -> Option<Self::Item> {
79-
self.next_back()
80-
}
8176
}
8277

8378
#[stable(feature = "rust1", since = "1.0.0")]

Diff for: ‎src/libcore/slice/mod.rs

-20
Original file line numberDiff line numberDiff line change
@@ -3547,11 +3547,6 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
35473547
(1, Some(self.v.len() + 1))
35483548
}
35493549
}
3550-
3551-
#[inline]
3552-
fn last(mut self) -> Option<Self::Item> {
3553-
self.next_back()
3554-
}
35553550
}
35563551

35573552
#[stable(feature = "rust1", since = "1.0.0")]
@@ -3650,11 +3645,6 @@ impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
36503645
(1, Some(self.v.len() + 1))
36513646
}
36523647
}
3653-
3654-
#[inline]
3655-
fn last(mut self) -> Option<Self::Item> {
3656-
self.next_back()
3657-
}
36583648
}
36593649

36603650
#[stable(feature = "rust1", since = "1.0.0")]
@@ -3720,11 +3710,6 @@ impl<'a, T, P> Iterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool {
37203710
fn size_hint(&self) -> (usize, Option<usize>) {
37213711
self.inner.size_hint()
37223712
}
3723-
3724-
#[inline]
3725-
fn last(mut self) -> Option<Self::Item> {
3726-
self.next_back()
3727-
}
37283713
}
37293714

37303715
#[stable(feature = "slice_rsplit", since = "1.27.0")]
@@ -3789,11 +3774,6 @@ impl<'a, T, P> Iterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool {
37893774
fn size_hint(&self) -> (usize, Option<usize>) {
37903775
self.inner.size_hint()
37913776
}
3792-
3793-
#[inline]
3794-
fn last(mut self) -> Option<Self::Item> {
3795-
self.next_back()
3796-
}
37973777
}
37983778

37993779
#[stable(feature = "slice_rsplit", since = "1.27.0")]

Diff for: ‎src/libcore/str/mod.rs

-20
Original file line numberDiff line numberDiff line change
@@ -1333,11 +1333,6 @@ impl<'a> Iterator for Lines<'a> {
13331333
fn size_hint(&self) -> (usize, Option<usize>) {
13341334
self.0.size_hint()
13351335
}
1336-
1337-
#[inline]
1338-
fn last(mut self) -> Option<Self::Item> {
1339-
self.next_back()
1340-
}
13411336
}
13421337

13431338
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1384,11 +1379,6 @@ impl<'a> Iterator for LinesAny<'a> {
13841379
fn size_hint(&self) -> (usize, Option<usize>) {
13851380
self.0.size_hint()
13861381
}
1387-
1388-
#[inline]
1389-
fn last(mut self) -> Option<Self::Item> {
1390-
self.next_back()
1391-
}
13921382
}
13931383

13941384
#[stable(feature = "rust1", since = "1.0.0")]
@@ -4231,11 +4221,6 @@ impl<'a> Iterator for SplitWhitespace<'a> {
42314221
fn size_hint(&self) -> (usize, Option<usize>) {
42324222
self.inner.size_hint()
42334223
}
4234-
4235-
#[inline]
4236-
fn last(mut self) -> Option<Self::Item> {
4237-
self.next_back()
4238-
}
42394224
}
42404225

42414226
#[stable(feature = "split_whitespace", since = "1.1.0")]
@@ -4262,11 +4247,6 @@ impl<'a> Iterator for SplitAsciiWhitespace<'a> {
42624247
fn size_hint(&self) -> (usize, Option<usize>) {
42634248
self.inner.size_hint()
42644249
}
4265-
4266-
#[inline]
4267-
fn last(mut self) -> Option<Self::Item> {
4268-
self.next_back()
4269-
}
42704250
}
42714251

42724252
#[stable(feature = "split_ascii_whitespace", since = "1.34.0")]

Diff for: ‎src/libstd/env.rs

-6
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,6 @@ impl Iterator for Args {
746746
self.inner.next().map(|s| s.into_string().unwrap())
747747
}
748748
fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
749-
#[inline]
750-
fn last(mut self) -> Option<String> {
751-
self.next_back()
752-
}
753749
}
754750

755751
#[stable(feature = "env", since = "1.0.0")]
@@ -785,8 +781,6 @@ impl Iterator for ArgsOs {
785781
type Item = OsString;
786782
fn next(&mut self) -> Option<OsString> { self.inner.next() }
787783
fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
788-
#[inline]
789-
fn last(mut self) -> Option<OsString> { self.next_back() }
790784
}
791785

792786
#[stable(feature = "env", since = "1.0.0")]

Diff for: ‎src/libstd/path.rs

-10
Original file line numberDiff line numberDiff line change
@@ -888,11 +888,6 @@ impl<'a> Iterator for Iter<'a> {
888888
fn next(&mut self) -> Option<&'a OsStr> {
889889
self.inner.next().map(Component::as_os_str)
890890
}
891-
892-
#[inline]
893-
fn last(mut self) -> Option<&'a OsStr> {
894-
self.next_back()
895-
}
896891
}
897892

898893
#[stable(feature = "rust1", since = "1.0.0")]
@@ -956,11 +951,6 @@ impl<'a> Iterator for Components<'a> {
956951
}
957952
None
958953
}
959-
960-
#[inline]
961-
fn last(mut self) -> Option<Self::Item> {
962-
self.next_back()
963-
}
964954
}
965955

966956
#[stable(feature = "rust1", since = "1.0.0")]

Diff for: ‎src/libstd/sys/unix/args.rs

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ impl Iterator for Args {
3535
type Item = OsString;
3636
fn next(&mut self) -> Option<OsString> { self.iter.next() }
3737
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
38-
#[inline]
39-
fn last(mut self) -> Option<OsString> { self.next_back() }
4038
}
4139

4240
impl ExactSizeIterator for Args {

Diff for: ‎src/libstd/sys/wasm/args.rs

-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ impl Iterator for Args {
3737
fn size_hint(&self) -> (usize, Option<usize>) {
3838
self.iter.size_hint()
3939
}
40-
#[inline]
41-
fn last(mut self) -> Option<OsString> {
42-
self.next_back()
43-
}
4440
}
4541

4642
impl ExactSizeIterator for Args {

Diff for: ‎src/libstd/sys/windows/args.rs

-2
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ impl Iterator for Args {
181181
type Item = OsString;
182182
fn next(&mut self) -> Option<OsString> { self.parsed_args_list.next() }
183183
fn size_hint(&self) -> (usize, Option<usize>) { self.parsed_args_list.size_hint() }
184-
#[inline]
185-
fn last(mut self) -> Option<OsString> { self.next_back() }
186184
}
187185

188186
impl DoubleEndedIterator for Args {

0 commit comments

Comments
 (0)
Please sign in to comment.