diff options
| author | bors <bors@rust-lang.org> | 2013-05-15 07:38:07 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-15 07:38:07 -0700 |
| commit | 4e8261009948ed1cfbbdaf4ecc3fadef795b27b7 (patch) | |
| tree | 4eb235105de5e0b361a7a661ca347530f51e8283 /src/libcore | |
| parent | 803c12d85fa898950d9efa9078b64519a1b78ab6 (diff) | |
| parent | a2a8596c3dd963e7b51f11998cffc46033bf6d63 (diff) | |
| download | rust-4e8261009948ed1cfbbdaf4ecc3fadef795b27b7.tar.gz rust-4e8261009948ed1cfbbdaf4ecc3fadef795b27b7.zip | |
auto merge of #6487 : recrack/rust/vec_len, r=thestinger
Rename vec::len(var) to var.len() ``` libcore, libfuzzer, librustc, librustdoc, libstd, libsyntax test/auxiliary test/bench test/run-pass ```
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/either.rs | 20 | ||||
| -rw-r--r-- | src/libcore/io.rs | 12 | ||||
| -rw-r--r-- | src/libcore/os.rs | 6 | ||||
| -rw-r--r-- | src/libcore/ptr.rs | 2 | ||||
| -rw-r--r-- | src/libcore/rt/uvll.rs | 2 | ||||
| -rw-r--r-- | src/libcore/str.rs | 8 |
6 files changed, 25 insertions, 25 deletions
diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 618a484a515..8c16f5c6482 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -201,14 +201,14 @@ fn test_lefts() { fn test_lefts_none() { let input: ~[Either<int, int>] = ~[Right(10), Right(10)]; let result = lefts(input); - assert_eq!(vec::len(result), 0u); + assert_eq!(result.len(), 0u); } #[test] fn test_lefts_empty() { let input: ~[Either<int, int>] = ~[]; let result = lefts(input); - assert_eq!(vec::len(result), 0u); + assert_eq!(result.len(), 0u); } #[test] @@ -222,14 +222,14 @@ fn test_rights() { fn test_rights_none() { let input: ~[Either<int, int>] = ~[Left(10), Left(10)]; let result = rights(input); - assert_eq!(vec::len(result), 0u); + assert_eq!(result.len(), 0u); } #[test] fn test_rights_empty() { let input: ~[Either<int, int>] = ~[]; let result = rights(input); - assert_eq!(vec::len(result), 0u); + assert_eq!(result.len(), 0u); } #[test] @@ -247,22 +247,22 @@ fn test_partition() { fn test_partition_no_lefts() { let input: ~[Either<int, int>] = ~[Right(10), Right(11)]; let (lefts, rights) = partition(input); - assert_eq!(vec::len(lefts), 0u); - assert_eq!(vec::len(rights), 2u); + assert_eq!(lefts.len(), 0u); + assert_eq!(rights.len(), 2u); } #[test] fn test_partition_no_rights() { let input: ~[Either<int, int>] = ~[Left(10), Left(11)]; let (lefts, rights) = partition(input); - assert_eq!(vec::len(lefts), 2u); - assert_eq!(vec::len(rights), 0u); + assert_eq!(lefts.len(), 2u); + assert_eq!(rights.len(), 0u); } #[test] fn test_partition_empty() { let input: ~[Either<int, int>] = ~[]; let (lefts, rights) = partition(input); - assert_eq!(vec::len(lefts), 0u); - assert_eq!(vec::len(rights), 0u); + assert_eq!(lefts.len(), 0u); + assert_eq!(rights.len(), 0u); } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index ab5db67ddb6..7b7d278380f 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -673,10 +673,10 @@ impl<T:Reader> ReaderUtil for T { fn read_char(&self) -> char { let c = self.read_chars(1); - if vec::len(c) == 0 { + if c.len() == 0 { return -1 as char; // FIXME will this stay valid? // #2004 } - assert!((vec::len(c) == 1)); + assert!(c.len() == 1); return c[0]; } @@ -1802,7 +1802,7 @@ mod tests { fn test_readchars_empty() { do io::with_str_reader(~"") |inp| { let res : ~[char] = inp.read_chars(128); - assert!((vec::len(res) == 0)); + assert!(res.len() == 0); } } @@ -1841,10 +1841,10 @@ mod tests { fn check_read_ln(len : uint, s: &str, ivals: &[int]) { do io::with_str_reader(s) |inp| { let res : ~[char] = inp.read_chars(len); - if (len <= vec::len(ivals)) { - assert!((vec::len(res) == len)); + if len <= ivals.len() { + assert!(res.len() == len); } - assert!(vec::slice(ivals, 0u, vec::len(res)) == + assert!(vec::slice(ivals, 0u, res.len()) == vec::map(res, |x| *x as int)); } } diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 9129b33fff5..daad9cee0fc 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -410,7 +410,7 @@ pub fn self_exe_path() -> Option<Path> { KERN_PROC as c_int, KERN_PROC_PATHNAME as c_int, -1 as c_int]; let mut sz = sz; - sysctl(vec::raw::to_ptr(mib), vec::len(mib) as ::libc::c_uint, + sysctl(vec::raw::to_ptr(mib), mib.len() as ::libc::c_uint, buf as *mut c_void, &mut sz, ptr::null(), 0u as size_t) == (0 as c_int) } @@ -1490,7 +1490,7 @@ mod tests { #[ignore] fn test_env_getenv() { let e = env(); - assert!(vec::len(e) > 0u); + assert!(e.len() > 0u); for e.each |p| { let (n, v) = copy *p; debug!(copy n); @@ -1581,7 +1581,7 @@ mod tests { fn list_dir() { let dirs = os::list_dir(&Path(".")); // Just assuming that we've got some contents in the current directory - assert!((vec::len(dirs) > 0u)); + assert!(dirs.len() > 0u); for dirs.each |dir| { debug!(copy *dir); diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 9feb8676036..e116dc01943 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -441,7 +441,7 @@ pub mod ptr_tests { let arr_ptr = &arr[0]; let mut ctr = 0; let mut iteration_count = 0; - array_each_with_len(arr_ptr, vec::len(arr), + array_each_with_len(arr_ptr, arr.len(), |e| { let actual = str::raw::from_c_str(e); let expected = copy expected_arr[ctr]; diff --git a/src/libcore/rt/uvll.rs b/src/libcore/rt/uvll.rs index 4bff3bff7d3..0d298bde6b5 100644 --- a/src/libcore/rt/uvll.rs +++ b/src/libcore/rt/uvll.rs @@ -221,7 +221,7 @@ pub unsafe fn accept(server: *c_void, client: *c_void) -> c_int { pub unsafe fn write<T>(req: *uv_write_t, stream: *T, buf_in: &[uv_buf_t], cb: *u8) -> c_int { let buf_ptr = vec::raw::to_ptr(buf_in); - let buf_cnt = vec::len(buf_in) as i32; + let buf_cnt = buf_in.len() as i32; return rust_uv_write(req as *c_void, stream as *c_void, buf_ptr, buf_cnt, cb); } pub unsafe fn read_start(stream: *uv_stream_t, on_alloc: *u8, on_read: *u8) -> c_int { diff --git a/src/libcore/str.rs b/src/libcore/str.rs index ce9db796b67..ec7177e5211 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -2059,7 +2059,7 @@ pub fn is_utf8(v: &const [u8]) -> bool { /// Determines if a vector of `u16` contains valid UTF-16 pub fn is_utf16(v: &[u16]) -> bool { - let len = vec::len(v); + let len = v.len(); let mut i = 0u; while (i < len) { let u = v[i]; @@ -2103,7 +2103,7 @@ pub fn to_utf16(s: &str) -> ~[u16] { } pub fn utf16_chars(v: &[u16], f: &fn(char)) { - let len = vec::len(v); + let len = v.len(); let mut i = 0u; while (i < len && v[i] != 0u16) { let u = v[i]; @@ -2128,7 +2128,7 @@ pub fn utf16_chars(v: &[u16], f: &fn(char)) { pub fn from_utf16(v: &[u16]) -> ~str { let mut buf = ~""; - reserve(&mut buf, vec::len(v)); + reserve(&mut buf, v.len()); utf16_chars(v, |ch| push_char(&mut buf, ch)); buf } @@ -2398,7 +2398,7 @@ static tag_six_b: uint = 252u; * # Example * * ~~~ - * let i = str::as_bytes("Hello World") { |bytes| vec::len(bytes) }; + * let i = str::as_bytes("Hello World") { |bytes| bytes.len() }; * ~~~ */ #[inline] |
