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 { Right(U) } -pub fn either(f_left: fn((&T)) -> V, - f_right: fn((&U)) -> V, value: &Either) -> V { +pub fn either(f_left: fn(&T) -> V, + f_right: fn(&U) -> V, value: &Either) -> 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(f: fn((&T))) -> bool { + fn get(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( * print_buf(buf) * } */ -pub fn iter(res: &Result, f: fn((&T))) { +pub fn iter(res: &Result, f: fn(&T)) { match *res { Ok(ref t) => f(t), Err(_) => () @@ -158,7 +158,7 @@ pub fn iter(res: &Result, f: fn((&T))) { * This function can be used to pass through a successful result while * handling an error. */ -pub fn iter_err(res: &Result, f: fn((&E))) { +pub fn iter_err(res: &Result, f: fn(&E)) { match *res { Ok(_) => (), Err(ref e) => f(e) @@ -179,7 +179,7 @@ pub fn iter_err(res: &Result, f: fn((&E))) { * parse_bytes(buf) * } */ -pub fn map(res: &Result, op: fn((&T)) -> U) +pub fn map(res: &Result, op: fn(&T) -> U) -> Result { match *res { Ok(ref t) => Ok(op(t)), @@ -195,7 +195,7 @@ pub fn map(res: &Result, 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(res: &Result, op: fn((&E)) -> F) +pub fn map_err(res: &Result, op: fn(&E) -> F) -> Result { match *res { Ok(copy t) => Ok(t), @@ -210,14 +210,14 @@ impl Result { 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 Result { impl Result { pure fn get() -> T { get(&self) } - fn map_err(op: fn((&E)) -> F) -> Result { + fn map_err(op: fn(&E) -> F) -> Result { match self { Ok(copy t) => Ok(t), Err(ref e) => Err(op(e)) @@ -239,7 +239,7 @@ impl Result { impl Result { pure fn get_err() -> E { get_err(&self) } - fn map(op: fn((&T)) -> U) -> Result { + fn map(op: fn(&T) -> U) -> Result { match self { Ok(ref t) => Ok(op(t)), Err(copy e) => Err(e) @@ -277,7 +277,7 @@ impl Result { * } */ pub fn map_vec( - ts: &[T], op: fn((&T)) -> Result) -> Result<~[V],U> { + ts: &[T], op: fn(&T) -> Result) -> 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( } pub fn map_opt( - o_t: &Option, op: fn((&T)) -> Result) -> Result,U> { + o_t: &Option, op: fn(&T) -> Result) -> Result,U> { match *o_t { None => Ok(None), @@ -311,7 +311,7 @@ pub fn map_opt( * to accommodate an error like the vectors being of different lengths. */ pub fn map_vec2(ss: &[S], ts: &[T], - op: fn((&S),(&T)) -> Result) -> Result<~[V],U> { + op: fn(&S,&T) -> Result) -> Result<~[V],U> { assert vec::same_length(ss, ts); let n = vec::len(ts); @@ -333,7 +333,7 @@ pub fn map_vec2(ss: &[S], ts: &[T], * on its own as no result vector is built. */ pub fn iter_vec2(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(s: &const ~str, f: fn((&~[u8])) -> T) -> T { +pub pure fn as_bytes(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(v: &[const T]) -> ~[T] { * Return true to continue, false to break. */ #[inline(always)] -pub pure fn each(v: &r/[T], f: fn((&r/T)) -> bool) { +pub pure fn each(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 diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index a1e29b03b45..200193a48a8 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -53,7 +53,7 @@ pub fn find(m: Treemap, k: K) -> Option { } /// Visit all pairs in the map in order. -pub fn traverse(m: Treemap, f: fn((&K), (&V))) { +pub fn traverse(m: Treemap, f: fn(&K, &V)) { match *m { Empty => (), /* diff --git a/src/libstd/future.rs b/src/libstd/future.rs index 17b487f16de..31144740c8a 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -51,7 +51,7 @@ impl Future { get_ref(self) } - fn with(blk: fn((&A)) -> B) -> B { + fn with(blk: fn(&A) -> B) -> B { //! Work with the value without copying it with(&self, blk) @@ -164,7 +164,7 @@ pub fn get(future: &Future) -> A { *get_ref(future) } -pub fn with(future: &Future, blk: fn((&A)) -> B) -> B { +pub fn with(future: &Future, blk: fn(&A) -> B) -> B { //! Work with the value without copying it blk(get_ref(future)) diff --git a/src/libstd/list.rs b/src/libstd/list.rs index d30bc853f71..35b9a92f5a8 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -29,7 +29,7 @@ pub fn from_vec(v: &[T]) -> @List { * * z - The initial value * * f - The function to apply */ -pub fn foldl(z: T, ls: @List, f: fn((&T), (&U)) -> T) -> T { +pub fn foldl(z: T, ls: @List, f: fn(&T, &U) -> T) -> T { let mut accum: T = z; do iter(ls) |elt| { accum = f(&accum, elt);} accum @@ -42,7 +42,7 @@ pub fn foldl(z: T, ls: @List, f: fn((&T), (&U)) -> T) -> T { * When function `f` returns true then an option containing the element * is returned. If `f` matches no elements then none is returned. */ -pub fn find(ls: @List, f: fn((&T)) -> bool) -> Option { +pub fn find(ls: @List, f: fn(&T) -> bool) -> Option { let mut ls = ls; loop { ls = match *ls { @@ -120,7 +120,7 @@ pure fn push(ll: &mut @list, vv: T) { */ /// Iterate over a list -pub fn iter(l: @List, f: fn((&T))) { +pub fn iter(l: @List, f: fn(&T)) { let mut cur = l; loop { cur = match *cur { @@ -134,7 +134,7 @@ pub fn iter(l: @List, f: fn((&T))) { } /// Iterate over a list -pub fn each(l: @List, f: fn((&T)) -> bool) { +pub fn each(l: @List, f: fn(&T) -> bool) { let mut cur = l; loop { cur = match *cur {