From: Jorge Aparicio Date: Mon, 5 Jan 2015 19:07:10 +0000 (-0500) Subject: replace `f.call_mut(a, b, ..)` with `f(a, b, ..)` X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=ec11f66dbf68c7d0a958b28e520f547c885a3fde;p=rust.git replace `f.call_mut(a, b, ..)` with `f(a, b, ..)` --- diff --git a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs index 787e25ea319..9053f97e8a7 100644 --- a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs @@ -29,7 +29,7 @@ fn innocent_looking_victim() { } else { match x { Some(ref msg) => { - f.c.call_mut((f, true)); + (f.c)(f, true); //~^ ERROR: cannot borrow `*f` as mutable more than once at a time println!("{}", msg); }, diff --git a/src/test/compile-fail/unboxed-closures-type-mismatch.rs b/src/test/compile-fail/unboxed-closures-type-mismatch.rs index b3528f7abe7..a25d6464867 100644 --- a/src/test/compile-fail/unboxed-closures-type-mismatch.rs +++ b/src/test/compile-fail/unboxed-closures-type-mismatch.rs @@ -14,6 +14,6 @@ pub fn main() { let mut f = |&mut: x: int, y: int| -> int { x + y }; - let z = f.call_mut((1u, 2)); //~ ERROR type mismatch + let z = f(1u, 2); //~ ERROR type mismatch println!("{}", z); } diff --git a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs index a96bde7cca4..85b33f73bbc 100644 --- a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs +++ b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs @@ -13,7 +13,7 @@ use std::ops::FnMut; fn call_it>(y: int, mut f: F) -> int { - f.call_mut((2, y)) + f(2, y) } pub fn main() { diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index a8ecc2decd0..3bcce538871 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -18,7 +18,7 @@ */ pub fn map(filename: String, mut emit: map_reduce::putter) { - emit.call_mut((filename, "1".to_string(),)); + emit(filename, "1".to_string()); } mod map_reduce { diff --git a/src/test/run-pass/issue-16668.rs b/src/test/run-pass/issue-16668.rs index f36594cb401..1febf337429 100644 --- a/src/test/run-pass/issue-16668.rs +++ b/src/test/run-pass/issue-16668.rs @@ -20,8 +20,8 @@ impl<'a, I, O: 'a> Parser<'a, I, O> { fn compose(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> { Parser { parse: box move |&mut: x: I| { - match (*self.parse).call_mut((x,)) { - Ok(r) => (*rhs.parse).call_mut((r,)), + match (self.parse)(x) { + Ok(r) => (rhs.parse)(r), Err(e) => Err(e) } } diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs index 651315ea641..528870d0334 100644 --- a/src/test/run-pass/issue-3424.rs +++ b/src/test/run-pass/issue-3424.rs @@ -27,7 +27,7 @@ fn tester() }; let path = path::Path::new("blah"); - assert!(loader.call_mut((&path,)).is_ok()); + assert!(loader(&path).is_ok()); } pub fn main() {} diff --git a/src/test/run-pass/overloaded-calls-simple.rs b/src/test/run-pass/overloaded-calls-simple.rs index b0a40f74ff9..bb5b88d3674 100644 --- a/src/test/run-pass/overloaded-calls-simple.rs +++ b/src/test/run-pass/overloaded-calls-simple.rs @@ -50,7 +50,7 @@ fn main() { x: 3, y: 3, }; - let ans = s.call_mut((3,)); + let ans = s(3); assert_eq!(ans, 27); let s = S2 { @@ -64,7 +64,7 @@ fn main() { x: 3, y: 3, }; - let ans = s.call_once((3, 1)); + let ans = s(3, 1); assert_eq!(ans, 27); } diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index b193ad7892a..bc397bb6319 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -42,19 +42,19 @@ struct Goldfyshe { } impl Pet for Catte { - fn name(&self, mut blk: Box) { blk.call_mut((self.name.as_slice(),)) } + fn name(&self, mut blk: Box) { blk(self.name.as_slice()) } fn num_legs(&self) -> uint { 4 } fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 } } impl Pet for Dogge { - fn name(&self, mut blk: Box) { blk.call_mut((self.name.as_slice(),)) } + fn name(&self, mut blk: Box) { blk(self.name.as_slice()) } fn num_legs(&self) -> uint { 4 } fn of_good_pedigree(&self) -> bool { self.bark_decibels < 70 || self.tricks_known > 20 } } impl Pet for Goldfyshe { - fn name(&self, mut blk: Box) { blk.call_mut((self.name.as_slice(),)) } + fn name(&self, mut blk: Box) { blk(self.name.as_slice()) } fn num_legs(&self) -> uint { 0 } fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 } } diff --git a/src/test/run-pass/unboxed-closures-boxed.rs b/src/test/run-pass/unboxed-closures-boxed.rs index ab3faa16f94..60e59400e1a 100644 --- a/src/test/run-pass/unboxed-closures-boxed.rs +++ b/src/test/run-pass/unboxed-closures-boxed.rs @@ -19,7 +19,7 @@ fn make_adder(x: int) -> Box+'static> { pub fn main() { let mut adder = make_adder(3); - let z = adder.call_mut((2,)); + let z = adder(2); println!("{}", z); assert_eq!(z, 5); } diff --git a/src/test/run-pass/unboxed-closures-extern-fn.rs b/src/test/run-pass/unboxed-closures-extern-fn.rs index 58657c2b718..a25f5e265e8 100644 --- a/src/test/run-pass/unboxed-closures-extern-fn.rs +++ b/src/test/run-pass/unboxed-closures-extern-fn.rs @@ -18,15 +18,15 @@ fn square(x: int) -> int { x * x } fn call_itint>(f: &F, x: int) -> int { - f.call((x,)) + f(x) } fn call_it_mutint>(f: &mut F, x: int) -> int { - f.call_mut((x,)) + f(x) } fn call_it_onceint>(f: F, x: int) -> int { - f.call_once((x,)) + f(x) } fn main() { diff --git a/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs b/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs index 77d41ae1907..8af0547e5e5 100644 --- a/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs +++ b/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs @@ -25,15 +25,15 @@ extern "rust-call" fn call(&self, (x,): (int,)) -> int { } fn call_itint>(f: &F, x: int) -> int { - f.call((x,)) + f(x) } fn call_it_mutint>(f: &mut F, x: int) -> int { - f.call_mut((x,)) + f(x) } fn call_it_onceint>(f: F, x: int) -> int { - f.call_once((x,)) + f(x) } fn main() { diff --git a/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs b/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs index 02395624cd1..068080e256d 100644 --- a/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs +++ b/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs @@ -25,11 +25,11 @@ extern "rust-call" fn call_mut(&mut self, (x,): (int,)) -> int { } fn call_it_mutint>(f: &mut F, x: int) -> int { - f.call_mut((x,)) + f(x) } fn call_it_onceint>(f: F, x: int) -> int { - f.call_once((x,)) + f(x) } fn main() { diff --git a/src/test/run-pass/unboxed-closures-generic.rs b/src/test/run-pass/unboxed-closures-generic.rs index 9d1d81fe259..0edeeb8d198 100644 --- a/src/test/run-pass/unboxed-closures-generic.rs +++ b/src/test/run-pass/unboxed-closures-generic.rs @@ -13,7 +13,7 @@ use std::ops::FnMut; fn call_it>(y: int, mut f: F) -> int { - f.call_mut((2, y)) + f(2, y) } pub fn main() { diff --git a/src/test/run-pass/unboxed-closures-manual-impl.rs b/src/test/run-pass/unboxed-closures-manual-impl.rs index 3a750dadb91..88c9ceae4a1 100644 --- a/src/test/run-pass/unboxed-closures-manual-impl.rs +++ b/src/test/run-pass/unboxed-closures-manual-impl.rs @@ -22,11 +22,11 @@ extern "rust-call" fn call_mut(&mut self, (x,): (int,)) -> int { } fn call_itint>(mut f: F, x: int) -> int { - f.call_mut((x,)) + 3 + f(x) + 3 } fn call_box(f: &mut FnMut(int) -> int, x: int) -> int { - f.call_mut((x,)) + 3 + f(x) + 3 } fn main() { diff --git a/src/test/run-pass/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures-prelude.rs index e31ef169e16..d1bd7e908c8 100644 --- a/src/test/run-pass/unboxed-closures-prelude.rs +++ b/src/test/run-pass/unboxed-closures-prelude.rs @@ -17,12 +17,12 @@ fn main() { task.call((0i, )); let mut task: Box int> = box |&mut: x| x; - task.call_mut((0i, )); + task(0i); call(|:x| x, 22); } fn call int>(f: F, x: int) -> int { - f.call_once((x,)) + f(x) } diff --git a/src/test/run-pass/unboxed-closures-simple.rs b/src/test/run-pass/unboxed-closures-simple.rs index f11096ba5ff..c473db4586f 100644 --- a/src/test/run-pass/unboxed-closures-simple.rs +++ b/src/test/run-pass/unboxed-closures-simple.rs @@ -14,6 +14,6 @@ pub fn main() { let mut f = |&mut: x: int, y: int| -> int { x + y }; - let z = f.call_mut((1, 2)); + let z = f(1, 2); assert_eq!(z, 3); } diff --git a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs index beab82e804b..780a1e6cdf0 100644 --- a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs +++ b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs @@ -12,6 +12,6 @@ fn main() { let onetime = |: x| x; - onetime.call_once((0i,)); + onetime(0i); }