diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2012-10-13 17:07:14 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-11-20 16:39:30 -0800 |
| commit | 9539724e8bf2a0109eeff3bec9fb49309de0f5f3 (patch) | |
| tree | 7b0cdbb708a1278ae33cf7b0b10d3ac027313b07 /src/libcore | |
| parent | 497a8b54b5b3f9daf0ec735d443c443ac29afeab (diff) | |
Remove parentheses from closure argument types
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/either.rs | 4 | ||||
| -rw-r--r-- | src/libcore/os.rs | 4 | ||||
| -rw-r--r-- | src/libcore/repr.rs | 2 | ||||
| -rw-r--r-- | src/libcore/result.rs | 24 | ||||
| -rw-r--r-- | src/libcore/str.rs | 2 | ||||
| -rw-r--r-- | src/libcore/vec.rs | 2 |
6 files changed, 19 insertions, 19 deletions
diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 5e3cbe45ef2..a8b0c117b8c 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -13,8 +13,8 @@ pub enum Either<T, U> { Right(U) } -pub fn either<T, U, V>(f_left: fn((&T)) -> V, - f_right: fn((&U)) -> V, value: &Either<T, U>) -> V { +pub fn either<T, U, V>(f_left: fn(&T) -> V, + f_right: fn(&U) -> V, value: &Either<T, U>) -> V { /*! * Applies a function based on the given either value * diff --git a/src/libcore/os.rs b/src/libcore/os.rs index a834bb84f8d..33878fdd478 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -489,11 +489,11 @@ pub fn tmpdir() -> Path { } } /// Recursively walk a directory structure -pub fn walk_dir(p: &Path, f: fn((&Path)) -> bool) { +pub fn walk_dir(p: &Path, f: fn(&Path) -> bool) { walk_dir_(p, f); - fn walk_dir_(p: &Path, f: fn((&Path)) -> bool) -> bool { + fn walk_dir_(p: &Path, f: fn(&Path) -> bool) -> bool { let mut keepgoing = true; do list_dir(p).each |q| { let path = &p.push(*q); diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index 6a4923eb047..0eee413cdad 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -140,7 +140,7 @@ impl ReprVisitor { // Various helpers for the TyVisitor impl #[inline(always)] - fn get<T>(f: fn((&T))) -> bool { + fn get<T>(f: fn(&T)) -> bool { unsafe { f(transmute::<*c_void,&T>(copy self.ptr)); } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 31d813dad92..5c59f429fd4 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -143,7 +143,7 @@ pub fn chain_err<T, U, V>( * print_buf(buf) * } */ -pub fn iter<T, E>(res: &Result<T, E>, f: fn((&T))) { +pub fn iter<T, E>(res: &Result<T, E>, f: fn(&T)) { match *res { Ok(ref t) => f(t), Err(_) => () @@ -158,7 +158,7 @@ pub fn iter<T, E>(res: &Result<T, E>, f: fn((&T))) { * This function can be used to pass through a successful result while * handling an error. */ -pub fn iter_err<T, E>(res: &Result<T, E>, f: fn((&E))) { +pub fn iter_err<T, E>(res: &Result<T, E>, f: fn(&E)) { match *res { Ok(_) => (), Err(ref e) => f(e) @@ -179,7 +179,7 @@ pub fn iter_err<T, E>(res: &Result<T, E>, f: fn((&E))) { * parse_bytes(buf) * } */ -pub fn map<T, E: Copy, U: Copy>(res: &Result<T, E>, op: fn((&T)) -> U) +pub fn map<T, E: Copy, U: Copy>(res: &Result<T, E>, op: fn(&T) -> U) -> Result<U, E> { match *res { Ok(ref t) => Ok(op(t)), @@ -195,7 +195,7 @@ pub fn map<T, E: Copy, U: Copy>(res: &Result<T, E>, op: fn((&T)) -> U) * is immediately returned. This function can be used to pass through a * successful result while handling an error. */ -pub fn map_err<T: Copy, E, F: Copy>(res: &Result<T, E>, op: fn((&E)) -> F) +pub fn map_err<T: Copy, E, F: Copy>(res: &Result<T, E>, op: fn(&E) -> F) -> Result<T, F> { match *res { Ok(copy t) => Ok(t), @@ -210,14 +210,14 @@ impl<T, E> Result<T, E> { pure fn is_err() -> bool { is_err(&self) } - pure fn iter(f: fn((&T))) { + pure fn iter(f: fn(&T)) { match self { Ok(ref t) => f(t), Err(_) => () } } - fn iter_err(f: fn((&E))) { + fn iter_err(f: fn(&E)) { match self { Ok(_) => (), Err(ref e) => f(e) @@ -228,7 +228,7 @@ impl<T, E> Result<T, E> { impl<T: Copy, E> Result<T, E> { pure fn get() -> T { get(&self) } - fn map_err<F:Copy>(op: fn((&E)) -> F) -> Result<T,F> { + fn map_err<F:Copy>(op: fn(&E) -> F) -> Result<T,F> { match self { Ok(copy t) => Ok(t), Err(ref e) => Err(op(e)) @@ -239,7 +239,7 @@ impl<T: Copy, E> Result<T, E> { impl<T, E: Copy> Result<T, E> { pure fn get_err() -> E { get_err(&self) } - fn map<U:Copy>(op: fn((&T)) -> U) -> Result<U,E> { + fn map<U:Copy>(op: fn(&T) -> U) -> Result<U,E> { match self { Ok(ref t) => Ok(op(t)), Err(copy e) => Err(e) @@ -277,7 +277,7 @@ impl<T: Copy, E: Copy> Result<T, E> { * } */ pub fn map_vec<T,U:Copy,V:Copy>( - ts: &[T], op: fn((&T)) -> Result<V,U>) -> Result<~[V],U> { + ts: &[T], op: fn(&T) -> Result<V,U>) -> Result<~[V],U> { let mut vs: ~[V] = vec::with_capacity(vec::len(ts)); for vec::each(ts) |t| { @@ -290,7 +290,7 @@ pub fn map_vec<T,U:Copy,V:Copy>( } pub fn map_opt<T,U:Copy,V:Copy>( - o_t: &Option<T>, op: fn((&T)) -> Result<V,U>) -> Result<Option<V>,U> { + o_t: &Option<T>, op: fn(&T) -> Result<V,U>) -> Result<Option<V>,U> { match *o_t { None => Ok(None), @@ -311,7 +311,7 @@ pub fn map_opt<T,U:Copy,V:Copy>( * to accommodate an error like the vectors being of different lengths. */ pub fn map_vec2<S,T,U:Copy,V:Copy>(ss: &[S], ts: &[T], - op: fn((&S),(&T)) -> Result<V,U>) -> Result<~[V],U> { + op: fn(&S,&T) -> Result<V,U>) -> Result<~[V],U> { assert vec::same_length(ss, ts); let n = vec::len(ts); @@ -333,7 +333,7 @@ pub fn map_vec2<S,T,U:Copy,V:Copy>(ss: &[S], ts: &[T], * on its own as no result vector is built. */ pub fn iter_vec2<S,T,U:Copy>(ss: &[S], ts: &[T], - op: fn((&S),(&T)) -> Result<(),U>) -> Result<(),U> { + op: fn(&S,&T) -> Result<(),U>) -> Result<(),U> { assert vec::same_length(ss, ts); let n = vec::len(ts); diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 971eaf5c857..2d8d1cd9fd8 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -1845,7 +1845,7 @@ const tag_six_b: uint = 252u; * let i = str::as_bytes("Hello World") { |bytes| vec::len(bytes) }; * ~~~ */ -pub pure fn as_bytes<T>(s: &const ~str, f: fn((&~[u8])) -> T) -> T { +pub pure fn as_bytes<T>(s: &const ~str, f: fn(&~[u8]) -> T) -> T { unsafe { let v: *~[u8] = cast::transmute(copy s); f(&*v) diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index e7821c1246c..8e99317468d 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1099,7 +1099,7 @@ pub pure fn reversed<T: Copy>(v: &[const T]) -> ~[T] { * Return true to continue, false to break. */ #[inline(always)] -pub pure fn each<T>(v: &r/[T], f: fn((&r/T)) -> bool) { +pub pure fn each<T>(v: &r/[T], f: fn(&r/T) -> bool) { // ^^^^ // NB---this CANNOT be &[const T]! The reason // is that you are passing it to `f()` using |
