diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-01-07 21:15:25 -0800 |
|---|---|---|
| committer | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-01-09 08:55:37 -0800 |
| commit | 2891a49f0d9b3c6cdd4fa8b0bd1f2a5d06cdac58 (patch) | |
| tree | 7da6504a2f97dfefc97752d17a57c31d81449f7e /src/libcore | |
| parent | 9a7e26156259560ac546a35dd285abe44728b1f5 (diff) | |
| download | rust-2891a49f0d9b3c6cdd4fa8b0bd1f2a5d06cdac58.tar.gz rust-2891a49f0d9b3c6cdd4fa8b0bd1f2a5d06cdac58.zip | |
core: rename vec.filter to vec.filtered
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/os.rs | 2 | ||||
| -rw-r--r-- | src/libcore/vec.rs | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 587d684c60c..6b3f97daa76 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -619,7 +619,7 @@ pub fn list_dir(p: &Path) -> ~[~str] { #[cfg(windows)] fn star(p: &Path) -> Path { p.push("*") } - do rustrt::rust_list_files2(star(p).to_str()).filter |filename| { + do rustrt::rust_list_files2(star(p).to_str()).filtered |filename| { *filename != ~"." && *filename != ~".." } } diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index ab0b5049f8e..511063bb44f 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -853,7 +853,7 @@ pub pure fn filter_map<T, U: Copy>(v: &[T], f: fn(t: &T) -> Option<U>) * Apply function `f` to each element of `v` and return a vector containing * only those elements for which `f` returned true. */ -pub pure fn filter<T: Copy>(v: &[T], f: fn(t: &T) -> bool) -> ~[T] { +pub pure fn filtered<T: Copy>(v: &[T], f: fn(t: &T) -> bool) -> ~[T] { let mut result = ~[]; for each(v) |elem| { if f(elem) { unsafe { result.push(*elem); } } @@ -1752,7 +1752,7 @@ impl<T: Eq> &[T]: ImmutableEqVector<T> { } pub trait ImmutableCopyableVector<T> { - pure fn filter(&self, f: fn(t: &T) -> bool) -> ~[T]; + pure fn filtered(&self, f: fn(&T) -> bool) -> ~[T]; pure fn rfind(&self, f: fn(t: &T) -> bool) -> Option<T>; pure fn partitioned(&self, f: fn(&T) -> bool) -> (~[T], ~[T]); } @@ -1767,8 +1767,8 @@ impl<T: Copy> &[T]: ImmutableCopyableVector<T> { * containing only those elements for which `f` returned true. */ #[inline] - pure fn filter(&self, f: fn(t: &T) -> bool) -> ~[T] { - filter(*self, f) + pure fn filtered(&self, f: fn(t: &T) -> bool) -> ~[T] { + filtered(*self, f) } /** @@ -3618,7 +3618,7 @@ mod tests { fn test_filter_fail() { let v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)]; let mut i = 0; - do filter(v) |_elt| { + do v.filtered |_elt| { if i == 2 { fail } |
