Skip to content

Commit 4cc3bbb

Browse files
committed
auto merge of #8095 : jmgrosen/rust/no-iterator-prefixes, r=pcwalton
Resolves #8093
2 parents 6dc5e2c + a0f0f30 commit 4cc3bbb

File tree

4 files changed

+90
-89
lines changed

4 files changed

+90
-89
lines changed

src/libextra/smallintmap.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
use std::iterator::{Iterator, IteratorUtil, EnumerateIterator, FilterMapIterator, InvertIterator};
1919
use std::uint;
2020
use std::util::replace;
21-
use std::vec::{VecIterator, VecMutIterator, VecConsumeIterator};
21+
use std::vec::{VecIterator, VecMutIterator};
22+
use std::vec;
2223

2324
#[allow(missing_doc)]
2425
pub struct SmallIntMap<T> {
@@ -204,7 +205,7 @@ impl<V> SmallIntMap<V> {
204205
/// Empties the hash map, moving all values into the specified closure
205206
pub fn consume(&mut self)
206207
-> FilterMapIterator<(uint, Option<V>), (uint, V),
207-
EnumerateIterator<VecConsumeIterator<Option<V>>>>
208+
EnumerateIterator<vec::ConsumeIterator<Option<V>>>>
208209
{
209210
let values = replace(&mut self.v, ~[]);
210211
values.consume_iter().enumerate().filter_map(|(i, v)| {

src/libstd/hashmap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ pub struct HashMapMutIterator<'self, K, V> {
538538

539539
/// HashMap consume iterator
540540
pub struct HashMapConsumeIterator<K, V> {
541-
priv iter: vec::VecConsumeRevIterator<Option<Bucket<K, V>>>,
541+
priv iter: vec::ConsumeRevIterator<Option<Bucket<K, V>>>,
542542
}
543543

544544
/// HashSet iterator
@@ -549,7 +549,7 @@ pub struct HashSetIterator<'self, K> {
549549

550550
/// HashSet consume iterator
551551
pub struct HashSetConsumeIterator<K> {
552-
priv iter: vec::VecConsumeRevIterator<Option<Bucket<K, ()>>>,
552+
priv iter: vec::ConsumeRevIterator<Option<Bucket<K, ()>>>,
553553
}
554554

555555
impl<'self, K, V> Iterator<(&'self K, &'self V)> for HashMapIterator<'self, K, V> {

src/libstd/str.rs

+45-45
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ impl<'self, C: CharEq> CharEq for &'self [C] {
281281

282282
/// An iterator over the substrings of a string, separated by `sep`.
283283
#[deriving(Clone)]
284-
pub struct StrCharSplitIterator<'self,Sep> {
284+
pub struct CharSplitIterator<'self,Sep> {
285285
priv string: &'self str,
286286
priv position: uint,
287287
priv sep: Sep,
@@ -296,13 +296,13 @@ pub struct StrCharSplitIterator<'self,Sep> {
296296
/// An iterator over the words of a string, separated by an sequence of whitespace
297297
pub type WordIterator<'self> =
298298
FilterIterator<'self, &'self str,
299-
StrCharSplitIterator<'self, extern "Rust" fn(char) -> bool>>;
299+
CharSplitIterator<'self, extern "Rust" fn(char) -> bool>>;
300300

301301
/// An iterator over the lines of a string, separated by either `\n` or (`\r\n`).
302302
pub type AnyLineIterator<'self> =
303-
MapIterator<'self, &'self str, &'self str, StrCharSplitIterator<'self, char>>;
303+
MapIterator<'self, &'self str, &'self str, CharSplitIterator<'self, char>>;
304304

305-
impl<'self, Sep: CharEq> Iterator<&'self str> for StrCharSplitIterator<'self, Sep> {
305+
impl<'self, Sep: CharEq> Iterator<&'self str> for CharSplitIterator<'self, Sep> {
306306
#[inline]
307307
fn next(&mut self) -> Option<&'self str> {
308308
if self.finished { return None }
@@ -349,7 +349,7 @@ impl<'self, Sep: CharEq> Iterator<&'self str> for StrCharSplitIterator<'self, Se
349349
/// An iterator over the start and end indicies of the matches of a
350350
/// substring within a larger string
351351
#[deriving(Clone)]
352-
pub struct StrMatchesIndexIterator<'self> {
352+
pub struct MatchesIndexIterator<'self> {
353353
priv haystack: &'self str,
354354
priv needle: &'self str,
355355
priv position: uint,
@@ -358,13 +358,13 @@ pub struct StrMatchesIndexIterator<'self> {
358358
/// An iterator over the substrings of a string separated by a given
359359
/// search string
360360
#[deriving(Clone)]
361-
pub struct StrStrSplitIterator<'self> {
362-
priv it: StrMatchesIndexIterator<'self>,
361+
pub struct StrSplitIterator<'self> {
362+
priv it: MatchesIndexIterator<'self>,
363363
priv last_end: uint,
364364
priv finished: bool
365365
}
366366

367-
impl<'self> Iterator<(uint, uint)> for StrMatchesIndexIterator<'self> {
367+
impl<'self> Iterator<(uint, uint)> for MatchesIndexIterator<'self> {
368368
#[inline]
369369
fn next(&mut self) -> Option<(uint, uint)> {
370370
// See Issue #1932 for why this is a naive search
@@ -395,7 +395,7 @@ impl<'self> Iterator<(uint, uint)> for StrMatchesIndexIterator<'self> {
395395
}
396396
}
397397

398-
impl<'self> Iterator<&'self str> for StrStrSplitIterator<'self> {
398+
impl<'self> Iterator<&'self str> for StrSplitIterator<'self> {
399399
#[inline]
400400
fn next(&mut self) -> Option<&'self str> {
401401
if self.finished { return None; }
@@ -1126,17 +1126,17 @@ impl Mutable for ~str {
11261126
pub trait StrSlice<'self> {
11271127
fn contains<'a>(&self, needle: &'a str) -> bool;
11281128
fn contains_char(&self, needle: char) -> bool;
1129-
fn iter(&self) -> StrCharIterator<'self>;
1130-
fn rev_iter(&self) -> StrCharRevIterator<'self>;
1131-
fn bytes_iter(&self) -> StrBytesIterator<'self>;
1132-
fn bytes_rev_iter(&self) -> StrBytesRevIterator<'self>;
1133-
fn split_iter<Sep: CharEq>(&self, sep: Sep) -> StrCharSplitIterator<'self, Sep>;
1134-
fn splitn_iter<Sep: CharEq>(&self, sep: Sep, count: uint) -> StrCharSplitIterator<'self, Sep>;
1129+
fn iter(&self) -> CharIterator<'self>;
1130+
fn rev_iter(&self) -> CharRevIterator<'self>;
1131+
fn bytes_iter(&self) -> BytesIterator<'self>;
1132+
fn bytes_rev_iter(&self) -> BytesRevIterator<'self>;
1133+
fn split_iter<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator<'self, Sep>;
1134+
fn splitn_iter<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitIterator<'self, Sep>;
11351135
fn split_options_iter<Sep: CharEq>(&self, sep: Sep, count: uint, allow_trailing_empty: bool)
1136-
-> StrCharSplitIterator<'self, Sep>;
1137-
fn matches_index_iter(&self, sep: &'self str) -> StrMatchesIndexIterator<'self>;
1138-
fn split_str_iter(&self, &'self str) -> StrStrSplitIterator<'self>;
1139-
fn line_iter(&self) -> StrCharSplitIterator<'self, char>;
1136+
-> CharSplitIterator<'self, Sep>;
1137+
fn matches_index_iter(&self, sep: &'self str) -> MatchesIndexIterator<'self>;
1138+
fn split_str_iter(&self, &'self str) -> StrSplitIterator<'self>;
1139+
fn line_iter(&self) -> CharSplitIterator<'self, char>;
11401140
fn any_line_iter(&self) -> AnyLineIterator<'self>;
11411141
fn word_iter(&self) -> WordIterator<'self>;
11421142
fn ends_with(&self, needle: &str) -> bool;
@@ -1222,30 +1222,30 @@ impl<'self> StrSlice<'self> for &'self str {
12221222
/// assert_eq!(v, ~['a', 'b', 'c', ' ', 'å', 'ä', 'ö']);
12231223
/// ~~~
12241224
#[inline]
1225-
fn iter(&self) -> StrCharIterator<'self> {
1226-
StrCharIterator {
1225+
fn iter(&self) -> CharIterator<'self> {
1226+
CharIterator {
12271227
index: 0,
12281228
string: *self
12291229
}
12301230
}
12311231
/// An iterator over the characters of `self`, in reverse order.
12321232
#[inline]
1233-
fn rev_iter(&self) -> StrCharRevIterator<'self> {
1234-
StrCharRevIterator {
1233+
fn rev_iter(&self) -> CharRevIterator<'self> {
1234+
CharRevIterator {
12351235
index: self.len(),
12361236
string: *self
12371237
}
12381238
}
12391239
12401240
/// An iterator over the bytes of `self`
12411241
#[inline]
1242-
fn bytes_iter(&self) -> StrBytesIterator<'self> {
1243-
StrBytesIterator { it: self.as_bytes().iter() }
1242+
fn bytes_iter(&self) -> BytesIterator<'self> {
1243+
BytesIterator { it: self.as_bytes().iter() }
12441244
}
12451245
/// An iterator over the bytes of `self`, in reverse order
12461246
#[inline]
1247-
fn bytes_rev_iter(&self) -> StrBytesRevIterator<'self> {
1248-
StrBytesRevIterator { it: self.as_bytes().rev_iter() }
1247+
fn bytes_rev_iter(&self) -> BytesRevIterator<'self> {
1248+
BytesRevIterator { it: self.as_bytes().rev_iter() }
12491249
}
12501250
12511251
/// An iterator over substrings of `self`, separated by characters
@@ -1261,15 +1261,15 @@ impl<'self> StrSlice<'self> for &'self str {
12611261
/// assert_eq!(v, ~["abc", "def", "ghi"]);
12621262
/// ~~~
12631263
#[inline]
1264-
fn split_iter<Sep: CharEq>(&self, sep: Sep) -> StrCharSplitIterator<'self, Sep> {
1264+
fn split_iter<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator<'self, Sep> {
12651265
self.split_options_iter(sep, self.len(), true)
12661266
}
12671267
12681268
/// An iterator over substrings of `self`, separated by characters
12691269
/// matched by `sep`, restricted to splitting at most `count`
12701270
/// times.
12711271
#[inline]
1272-
fn splitn_iter<Sep: CharEq>(&self, sep: Sep, count: uint) -> StrCharSplitIterator<'self, Sep> {
1272+
fn splitn_iter<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitIterator<'self, Sep> {
12731273
self.split_options_iter(sep, count, true)
12741274
}
12751275
@@ -1279,9 +1279,9 @@ impl<'self> StrSlice<'self> for &'self str {
12791279
/// exists.
12801280
#[inline]
12811281
fn split_options_iter<Sep: CharEq>(&self, sep: Sep, count: uint, allow_trailing_empty: bool)
1282-
-> StrCharSplitIterator<'self, Sep> {
1282+
-> CharSplitIterator<'self, Sep> {
12831283
let only_ascii = sep.only_ascii();
1284-
StrCharSplitIterator {
1284+
CharSplitIterator {
12851285
string: *self,
12861286
position: 0,
12871287
sep: sep,
@@ -1294,9 +1294,9 @@ impl<'self> StrSlice<'self> for &'self str {
12941294
/// An iterator over the start and end indices of each match of
12951295
/// `sep` within `self`.
12961296
#[inline]
1297-
fn matches_index_iter(&self, sep: &'self str) -> StrMatchesIndexIterator<'self> {
1297+
fn matches_index_iter(&self, sep: &'self str) -> MatchesIndexIterator<'self> {
12981298
assert!(!sep.is_empty())
1299-
StrMatchesIndexIterator {
1299+
MatchesIndexIterator {
13001300
haystack: *self,
13011301
needle: sep,
13021302
position: 0
@@ -1313,8 +1313,8 @@ impl<'self> StrSlice<'self> for &'self str {
13131313
* ~~~
13141314
*/
13151315
#[inline]
1316-
fn split_str_iter(&self, sep: &'self str) -> StrStrSplitIterator<'self> {
1317-
StrStrSplitIterator {
1316+
fn split_str_iter(&self, sep: &'self str) -> StrSplitIterator<'self> {
1317+
StrSplitIterator {
13181318
it: self.matches_index_iter(sep),
13191319
last_end: 0,
13201320
finished: false
@@ -1324,7 +1324,7 @@ impl<'self> StrSlice<'self> for &'self str {
13241324
/// An iterator over the lines of a string (subsequences separated
13251325
/// by `\n`).
13261326
#[inline]
1327-
fn line_iter(&self) -> StrCharSplitIterator<'self, char> {
1327+
fn line_iter(&self) -> CharSplitIterator<'self, char> {
13281328
self.split_options_iter('\n', self.len(), false)
13291329
}
13301330
@@ -2253,12 +2253,12 @@ impl Clone for @str {
22532253
/// External iterator for a string's characters. Use with the `std::iterator`
22542254
/// module.
22552255
#[deriving(Clone)]
2256-
pub struct StrCharIterator<'self> {
2256+
pub struct CharIterator<'self> {
22572257
priv index: uint,
22582258
priv string: &'self str,
22592259
}
22602260
2261-
impl<'self> Iterator<char> for StrCharIterator<'self> {
2261+
impl<'self> Iterator<char> for CharIterator<'self> {
22622262
#[inline]
22632263
fn next(&mut self) -> Option<char> {
22642264
if self.index < self.string.len() {
@@ -2273,12 +2273,12 @@ impl<'self> Iterator<char> for StrCharIterator<'self> {
22732273
/// External iterator for a string's characters in reverse order. Use
22742274
/// with the `std::iterator` module.
22752275
#[deriving(Clone)]
2276-
pub struct StrCharRevIterator<'self> {
2276+
pub struct CharRevIterator<'self> {
22772277
priv index: uint,
22782278
priv string: &'self str,
22792279
}
22802280
2281-
impl<'self> Iterator<char> for StrCharRevIterator<'self> {
2281+
impl<'self> Iterator<char> for CharRevIterator<'self> {
22822282
#[inline]
22832283
fn next(&mut self) -> Option<char> {
22842284
if self.index > 0 {
@@ -2294,11 +2294,11 @@ impl<'self> Iterator<char> for StrCharRevIterator<'self> {
22942294
/// External iterator for a string's bytes. Use with the `std::iterator`
22952295
/// module.
22962296
#[deriving(Clone)]
2297-
pub struct StrBytesIterator<'self> {
2297+
pub struct BytesIterator<'self> {
22982298
priv it: vec::VecIterator<'self, u8>
22992299
}
23002300
2301-
impl<'self> Iterator<u8> for StrBytesIterator<'self> {
2301+
impl<'self> Iterator<u8> for BytesIterator<'self> {
23022302
#[inline]
23032303
fn next(&mut self) -> Option<u8> {
23042304
self.it.next().map_consume(|&x| x)
@@ -2308,11 +2308,11 @@ impl<'self> Iterator<u8> for StrBytesIterator<'self> {
23082308
/// External iterator for a string's bytes in reverse order. Use with
23092309
/// the `std::iterator` module.
23102310
#[deriving(Clone)]
2311-
pub struct StrBytesRevIterator<'self> {
2312-
priv it: vec::VecRevIterator<'self, u8>
2311+
pub struct BytesRevIterator<'self> {
2312+
priv it: vec::RevIterator<'self, u8>
23132313
}
23142314
2315-
impl<'self> Iterator<u8> for StrBytesRevIterator<'self> {
2315+
impl<'self> Iterator<u8> for BytesRevIterator<'self> {
23162316
#[inline]
23172317
fn next(&mut self) -> Option<u8> {
23182318
self.it.next().map_consume(|&x| x)

0 commit comments

Comments
 (0)