Skip to content

Commit ec11f66

Browse files
author
Jorge Aparicio
committed
replace f.call_mut(a, b, ..) with f(a, b, ..)
1 parent c98814b commit ec11f66

17 files changed

+28
-28
lines changed

src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn innocent_looking_victim() {
2929
} else {
3030
match x {
3131
Some(ref msg) => {
32-
f.c.call_mut((f, true));
32+
(f.c)(f, true);
3333
//~^ ERROR: cannot borrow `*f` as mutable more than once at a time
3434
println!("{}", msg);
3535
},

src/test/compile-fail/unboxed-closures-type-mismatch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ use std::ops::FnMut;
1414

1515
pub fn main() {
1616
let mut f = |&mut: x: int, y: int| -> int { x + y };
17-
let z = f.call_mut((1u, 2)); //~ ERROR type mismatch
17+
let z = f(1u, 2); //~ ERROR type mismatch
1818
println!("{}", z);
1919
}

src/test/compile-fail/unboxed-closures-vtable-mismatch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use std::ops::FnMut;
1414

1515
fn call_it<F:FnMut<(int,int),int>>(y: int, mut f: F) -> int {
16-
f.call_mut((2, y))
16+
f(2, y)
1717
}
1818

1919
pub fn main() {

src/test/run-pass/hashmap-memory.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
pub fn map(filename: String, mut emit: map_reduce::putter) {
21-
emit.call_mut((filename, "1".to_string(),));
21+
emit(filename, "1".to_string());
2222
}
2323

2424
mod map_reduce {

src/test/run-pass/issue-16668.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ impl<'a, I, O: 'a> Parser<'a, I, O> {
2020
fn compose<K: 'a>(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> {
2121
Parser {
2222
parse: box move |&mut: x: I| {
23-
match (*self.parse).call_mut((x,)) {
24-
Ok(r) => (*rhs.parse).call_mut((r,)),
23+
match (self.parse)(x) {
24+
Ok(r) => (rhs.parse)(r),
2525
Err(e) => Err(e)
2626
}
2727
}

src/test/run-pass/issue-3424.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn tester()
2727
};
2828

2929
let path = path::Path::new("blah");
30-
assert!(loader.call_mut((&path,)).is_ok());
30+
assert!(loader(&path).is_ok());
3131
}
3232

3333
pub fn main() {}

src/test/run-pass/overloaded-calls-simple.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn main() {
5050
x: 3,
5151
y: 3,
5252
};
53-
let ans = s.call_mut((3,));
53+
let ans = s(3);
5454

5555
assert_eq!(ans, 27);
5656
let s = S2 {
@@ -64,7 +64,7 @@ fn main() {
6464
x: 3,
6565
y: 3,
6666
};
67-
let ans = s.call_once((3, 1));
67+
let ans = s(3, 1);
6868
assert_eq!(ans, 27);
6969
}
7070

src/test/run-pass/trait-bounds-in-arc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ struct Goldfyshe {
4242
}
4343

4444
impl Pet for Catte {
45-
fn name(&self, mut blk: Box<FnMut(&str)>) { blk.call_mut((self.name.as_slice(),)) }
45+
fn name(&self, mut blk: Box<FnMut(&str)>) { blk(self.name.as_slice()) }
4646
fn num_legs(&self) -> uint { 4 }
4747
fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 }
4848
}
4949
impl Pet for Dogge {
50-
fn name(&self, mut blk: Box<FnMut(&str)>) { blk.call_mut((self.name.as_slice(),)) }
50+
fn name(&self, mut blk: Box<FnMut(&str)>) { blk(self.name.as_slice()) }
5151
fn num_legs(&self) -> uint { 4 }
5252
fn of_good_pedigree(&self) -> bool {
5353
self.bark_decibels < 70 || self.tricks_known > 20
5454
}
5555
}
5656
impl Pet for Goldfyshe {
57-
fn name(&self, mut blk: Box<FnMut(&str)>) { blk.call_mut((self.name.as_slice(),)) }
57+
fn name(&self, mut blk: Box<FnMut(&str)>) { blk(self.name.as_slice()) }
5858
fn num_legs(&self) -> uint { 0 }
5959
fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 }
6060
}

src/test/run-pass/unboxed-closures-boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::ops::FnMut;
1919

2020
pub fn main() {
2121
let mut adder = make_adder(3);
22-
let z = adder.call_mut((2,));
22+
let z = adder(2);
2323
println!("{}", z);
2424
assert_eq!(z, 5);
2525
}

src/test/run-pass/unboxed-closures-extern-fn.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ use std::ops::{Fn,FnMut,FnOnce};
1818
fn square(x: int) -> int { x * x }
1919

2020
fn call_it<F:Fn(int)->int>(f: &F, x: int) -> int {
21-
f.call((x,))
21+
f(x)
2222
}
2323

2424
fn call_it_mut<F:FnMut(int)->int>(f: &mut F, x: int) -> int {
25-
f.call_mut((x,))
25+
f(x)
2626
}
2727

2828
fn call_it_once<F:FnOnce(int)->int>(f: F, x: int) -> int {
29-
f.call_once((x,))
29+
f(x)
3030
}
3131

3232
fn main() {

src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ impl Fn<(int,),int> for S {
2525
}
2626

2727
fn call_it<F:Fn(int)->int>(f: &F, x: int) -> int {
28-
f.call((x,))
28+
f(x)
2929
}
3030

3131
fn call_it_mut<F:FnMut(int)->int>(f: &mut F, x: int) -> int {
32-
f.call_mut((x,))
32+
f(x)
3333
}
3434

3535
fn call_it_once<F:FnOnce(int)->int>(f: F, x: int) -> int {
36-
f.call_once((x,))
36+
f(x)
3737
}
3838

3939
fn main() {

src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ impl FnMut<(int,),int> for S {
2525
}
2626

2727
fn call_it_mut<F:FnMut(int)->int>(f: &mut F, x: int) -> int {
28-
f.call_mut((x,))
28+
f(x)
2929
}
3030

3131
fn call_it_once<F:FnOnce(int)->int>(f: F, x: int) -> int {
32-
f.call_once((x,))
32+
f(x)
3333
}
3434

3535
fn main() {

src/test/run-pass/unboxed-closures-generic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use std::ops::FnMut;
1414

1515
fn call_it<F:FnMut<(int,int),int>>(y: int, mut f: F) -> int {
16-
f.call_mut((2, y))
16+
f(2, y)
1717
}
1818

1919
pub fn main() {

src/test/run-pass/unboxed-closures-manual-impl.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ impl FnMut<(int,),int> for S {
2222
}
2323

2424
fn call_it<F:FnMut(int)->int>(mut f: F, x: int) -> int {
25-
f.call_mut((x,)) + 3
25+
f(x) + 3
2626
}
2727

2828
fn call_box(f: &mut FnMut(int) -> int, x: int) -> int {
29-
f.call_mut((x,)) + 3
29+
f(x) + 3
3030
}
3131

3232
fn main() {

src/test/run-pass/unboxed-closures-prelude.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ fn main() {
1717
task.call((0i, ));
1818

1919
let mut task: Box<FnMut(int) -> int> = box |&mut: x| x;
20-
task.call_mut((0i, ));
20+
task(0i);
2121

2222
call(|:x| x, 22);
2323
}
2424

2525
fn call<F:FnOnce(int) -> int>(f: F, x: int) -> int {
26-
f.call_once((x,))
26+
f(x)
2727
}
2828

src/test/run-pass/unboxed-closures-simple.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ use std::ops::FnMut;
1414

1515
pub fn main() {
1616
let mut f = |&mut: x: int, y: int| -> int { x + y };
17-
let z = f.call_mut((1, 2));
17+
let z = f(1, 2);
1818
assert_eq!(z, 3);
1919
}

src/test/run-pass/unboxed-closures-static-call-fn-once.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
fn main() {
1414
let onetime = |: x| x;
15-
onetime.call_once((0i,));
15+
onetime(0i);
1616
}
1717

0 commit comments

Comments
 (0)