]> git.lizzy.rs Git - rust.git/commitdiff
replace `f.call_mut(a, b, ..)` with `f(a, b, ..)`
authorJorge Aparicio <japaricious@gmail.com>
Mon, 5 Jan 2015 19:07:10 +0000 (14:07 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Mon, 5 Jan 2015 22:22:18 +0000 (17:22 -0500)
17 files changed:
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
src/test/compile-fail/unboxed-closures-type-mismatch.rs
src/test/compile-fail/unboxed-closures-vtable-mismatch.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/issue-16668.rs
src/test/run-pass/issue-3424.rs
src/test/run-pass/overloaded-calls-simple.rs
src/test/run-pass/trait-bounds-in-arc.rs
src/test/run-pass/unboxed-closures-boxed.rs
src/test/run-pass/unboxed-closures-extern-fn.rs
src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs
src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs
src/test/run-pass/unboxed-closures-generic.rs
src/test/run-pass/unboxed-closures-manual-impl.rs
src/test/run-pass/unboxed-closures-prelude.rs
src/test/run-pass/unboxed-closures-simple.rs
src/test/run-pass/unboxed-closures-static-call-fn-once.rs

index 787e25ea319544606154d49020210379426a1f91..9053f97e8a7dd9368c3395160701510edf8b72e3 100644 (file)
@@ -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);
                 },
index b3528f7abe71927f0c8284dae48340f0d1347bb6..a25d646486712fb30dccbb4121dc0540b2a598b4 100644 (file)
@@ -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);
 }
index a96bde7cca4cdcb06ce12c1140709b7b9aa22e32..85b33f73bbcb7cdefbbc419691ba8738458206f8 100644 (file)
@@ -13,7 +13,7 @@
 use std::ops::FnMut;
 
 fn call_it<F:FnMut<(int,int),int>>(y: int, mut f: F) -> int {
-    f.call_mut((2, y))
+    f(2, y)
 }
 
 pub fn main() {
index a8ecc2decd08af887b8e98a24227bdefd4e1fad1..3bcce5388715d6e34df5117549980565e4d765ef 100644 (file)
@@ -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 {
index f36594cb401450b683707ae717c752eafefe1499..1febf33742974ba2e49616219c3367b2504648ff 100644 (file)
@@ -20,8 +20,8 @@ impl<'a, I, O: 'a> Parser<'a, I, O> {
     fn compose<K: 'a>(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)
                 }
             }
index 651315ea6417347bbd1868d0104f64535b3409ab..528870d033476e70fcc0c1abb95af0489b0aaabc 100644 (file)
@@ -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() {}
index b0a40f74ff973dff2466d35148406636cb71ec63..bb5b88d3674a1b8d1d42be64c75ebfd5db397bc4 100644 (file)
@@ -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);
 }
 
index b193ad7892a6d965a8a54213663c9410e8409845..bc397bb63196e193b6b188278af9d1ba7afdff52 100644 (file)
@@ -42,19 +42,19 @@ struct Goldfyshe {
 }
 
 impl Pet for Catte {
-    fn name(&self, mut blk: Box<FnMut(&str)>) { blk.call_mut((self.name.as_slice(),)) }
+    fn name(&self, mut blk: Box<FnMut(&str)>) { 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<FnMut(&str)>) { blk.call_mut((self.name.as_slice(),)) }
+    fn name(&self, mut blk: Box<FnMut(&str)>) { 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<FnMut(&str)>) { blk.call_mut((self.name.as_slice(),)) }
+    fn name(&self, mut blk: Box<FnMut(&str)>) { blk(self.name.as_slice()) }
     fn num_legs(&self) -> uint { 0 }
     fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 }
 }
index ab3faa16f948ffc2428e05f466a4f579e9720c96..60e59400e1a092d8149098acf1119a5463702917 100644 (file)
@@ -19,7 +19,7 @@ fn make_adder(x: int) -> Box<FnMut<(int,),int>+'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);
 }
index 58657c2b71880dbcbdea73719ad698847e056e58..a25f5e265e81494a8f7eb4db4867f0d3e053a7b6 100644 (file)
 fn square(x: int) -> int { x * x }
 
 fn call_it<F:Fn(int)->int>(f: &F, x: int) -> int {
-    f.call((x,))
+    f(x)
 }
 
 fn call_it_mut<F:FnMut(int)->int>(f: &mut F, x: int) -> int {
-    f.call_mut((x,))
+    f(x)
 }
 
 fn call_it_once<F:FnOnce(int)->int>(f: F, x: int) -> int {
-    f.call_once((x,))
+    f(x)
 }
 
 fn main() {
index 77d41ae190778a738cf39661311eeb7b5fede41e..8af0547e5e57f6384d6d0c0a7c29a4ac6adb8116 100644 (file)
@@ -25,15 +25,15 @@ extern "rust-call" fn call(&self, (x,): (int,)) -> int {
 }
 
 fn call_it<F:Fn(int)->int>(f: &F, x: int) -> int {
-    f.call((x,))
+    f(x)
 }
 
 fn call_it_mut<F:FnMut(int)->int>(f: &mut F, x: int) -> int {
-    f.call_mut((x,))
+    f(x)
 }
 
 fn call_it_once<F:FnOnce(int)->int>(f: F, x: int) -> int {
-    f.call_once((x,))
+    f(x)
 }
 
 fn main() {
index 02395624cd123b2c310115c9920286b5048d5bac..068080e256dba3cd8d093b98ca1e02aa1a923b3f 100644 (file)
@@ -25,11 +25,11 @@ extern "rust-call" fn call_mut(&mut self, (x,): (int,)) -> int {
 }
 
 fn call_it_mut<F:FnMut(int)->int>(f: &mut F, x: int) -> int {
-    f.call_mut((x,))
+    f(x)
 }
 
 fn call_it_once<F:FnOnce(int)->int>(f: F, x: int) -> int {
-    f.call_once((x,))
+    f(x)
 }
 
 fn main() {
index 9d1d81fe259b3683e0ba7b307694442ac3ddca3d..0edeeb8d198dabe5f615765da529c803bead7a4f 100644 (file)
@@ -13,7 +13,7 @@
 use std::ops::FnMut;
 
 fn call_it<F:FnMut<(int,int),int>>(y: int, mut f: F) -> int {
-    f.call_mut((2, y))
+    f(2, y)
 }
 
 pub fn main() {
index 3a750dadb911c4ca2e30e7746798131b3e9f26b4..88c9ceae4a1248154257d2b828253e7bc5cfa79c 100644 (file)
@@ -22,11 +22,11 @@ extern "rust-call" fn call_mut(&mut self, (x,): (int,)) -> int {
 }
 
 fn call_it<F:FnMut(int)->int>(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() {
index e31ef169e16eb2ff5ee5b3e8b83f33605be13f04..d1bd7e908c826019c4088a1504a8d8b8ad03dba7 100644 (file)
@@ -17,12 +17,12 @@ fn main() {
     task.call((0i, ));
 
     let mut task: Box<FnMut(int) -> int> = box |&mut: x| x;
-    task.call_mut((0i, ));
+    task(0i);
 
     call(|:x| x, 22);
 }
 
 fn call<F:FnOnce(int) -> int>(f: F, x: int) -> int {
-    f.call_once((x,))
+    f(x)
 }
 
index f11096ba5ffc6b732ef0f739423e944cee2c9948..c473db4586ff74283027b4873708ec42d9c0b244 100644 (file)
@@ -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);
 }
index beab82e804bf74b8ba0054b3fac8185356a45cd6..780a1e6cdf0340c7b249918e4188a4eca842a9b7 100644 (file)
@@ -12,6 +12,6 @@
 
 fn main() {
     let onetime = |: x| x;
-    onetime.call_once((0i,));
+    onetime(0i);
 }