std: Iterator.len_ -> .len

This commit is contained in:
Erick Tryzelaar 2013-08-09 20:30:03 -07:00
parent 74d2552b0a
commit f9dee04aaa
5 changed files with 14 additions and 15 deletions

View File

@ -938,7 +938,7 @@ fn disassemble_extract(config: &config, _props: &TestProps,
fn count_extracted_lines(p: &Path) -> uint {
let x = io::read_whole_file_str(&p.with_filetype("ll")).unwrap();
x.line_iter().len_()
x.line_iter().len()
}

View File

@ -1077,7 +1077,7 @@ mod tests {
let v = &[0, ..128];
let m: DList<int> = v.iter().map(|&x|x).collect();
do b.iter {
assert!(m.iter().len_() == 128);
assert!(m.iter().len() == 128);
}
}
#[bench]
@ -1085,7 +1085,7 @@ mod tests {
let v = &[0, ..128];
let mut m: DList<int> = v.iter().map(|&x|x).collect();
do b.iter {
assert!(m.mut_iter().len_() == 128);
assert!(m.mut_iter().len() == 128);
}
}
#[bench]
@ -1093,7 +1093,7 @@ mod tests {
let v = &[0, ..128];
let m: DList<int> = v.iter().map(|&x|x).collect();
do b.iter {
assert!(m.rev_iter().len_() == 128);
assert!(m.rev_iter().len() == 128);
}
}
#[bench]
@ -1101,7 +1101,7 @@ mod tests {
let v = &[0, ..128];
let mut m: DList<int> = v.iter().map(|&x|x).collect();
do b.iter {
assert!(m.mut_rev_iter().len_() == 128);
assert!(m.mut_rev_iter().len() == 128);
}
}
}

View File

@ -200,7 +200,7 @@ fn try_parsing_version(s: &str) -> Option<Version> {
/// Just an approximation
fn is_url_like(p: &Path) -> bool {
let str = p.to_str();
str.split_iter('/').len_() > 2
str.split_iter('/').len() > 2
}
/// If s is of the form foo#bar, where bar is a valid version
@ -215,7 +215,7 @@ pub fn split_version_general<'a>(s: &'a str, sep: char) -> Option<(&'a str, Vers
for st in s.split_iter(sep) {
debug!("whole = %s part = %s", s, st);
}
if s.split_iter(sep).len_() > 2 {
if s.split_iter(sep).len() > 2 {
return None;
}
match s.rfind(sep) {

View File

@ -409,7 +409,6 @@ pub trait Iterator<A> {
accum
}
// FIXME: #5898: should be called len
/// Counts the number of elements in this iterator.
///
/// # Example
@ -417,11 +416,11 @@ pub trait Iterator<A> {
/// ~~~ {.rust}
/// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter();
/// assert!(it.len_() == 5);
/// assert!(it.len_() == 0);
/// assert!(it.len() == 5);
/// assert!(it.len() == 0);
/// ~~~
#[inline]
fn len_(&mut self) -> uint {
fn len(&mut self) -> uint {
self.fold(0, |cnt, _x| cnt + 1)
}
@ -1718,9 +1717,9 @@ mod tests {
#[test]
fn test_iterator_len() {
let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
assert_eq!(v.slice(0, 4).iter().len_(), 4);
assert_eq!(v.slice(0, 10).iter().len_(), 10);
assert_eq!(v.slice(0, 0).iter().len_(), 0);
assert_eq!(v.slice(0, 4).iter().len(), 4);
assert_eq!(v.slice(0, 10).iter().len(), 10);
assert_eq!(v.slice(0, 0).iter().len(), 0);
}
#[test]

View File

@ -1593,7 +1593,7 @@ impl<'self> StrSlice<'self> for &'self str {
/// Returns the number of characters that a string holds
#[inline]
fn char_len(&self) -> uint { self.iter().len_() }
fn char_len(&self) -> uint { self.iter().len() }
/// Returns a slice of the given string from the byte range
/// [`begin`..`end`)