Skip to content

Commit 2049016

Browse files
committed
test: Remove most uses of &fn() from the tests.
1 parent 7e3f201 commit 2049016

File tree

145 files changed

+249
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+249
-256
lines changed

src/test/auxiliary/cci_impl_lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
#[link(name="cci_impl_lib", vers="0.0")];
1212

1313
trait uint_helpers {
14-
fn to(&self, v: uint, f: &fn(uint));
14+
fn to(&self, v: uint, f: |uint|);
1515
}
1616

1717
impl uint_helpers for uint {
1818
#[inline]
19-
fn to(&self, v: uint, f: &fn(uint)) {
19+
fn to(&self, v: uint, f: |uint|) {
2020
let mut i = *self;
2121
while i < v {
2222
f(i);

src/test/auxiliary/cci_iter_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#[link(name="cci_iter_lib", vers="0.0")];
1212

1313
#[inline]
14-
pub fn iter<T>(v: &[T], f: &fn(&T)) {
14+
pub fn iter<T>(v: &[T], f: |&T|) {
1515
let mut i = 0u;
1616
let n = v.len();
1717
while i < n {

src/test/auxiliary/cci_no_inline_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#[link(name="cci_no_inline_lib", vers="0.0")];
1212

1313
// same as cci_iter_lib, more-or-less, but not marked inline
14-
pub fn iter(v: ~[uint], f: &fn(uint)) {
14+
pub fn iter(v: ~[uint], f: |uint|) {
1515
let mut i = 0u;
1616
let n = v.len();
1717
while i < n {

src/test/bench/core-map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::trie::TrieMap;
1919
use std::uint;
2020
use std::vec;
2121

22-
fn timed(label: &str, f: &fn()) {
22+
fn timed(label: &str, f: ||) {
2323
let start = time::precise_time_s();
2424
f();
2525
let end = time::precise_time_s();

src/test/bench/core-set.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct Results {
2727
delete_strings: f64
2828
}
2929

30-
fn timed(result: &mut f64, op: &fn()) {
30+
fn timed(result: &mut f64, op: ||) {
3131
let start = extra::time::precise_time_s();
3232
op();
3333
let end = extra::time::precise_time_s();
@@ -36,13 +36,12 @@ fn timed(result: &mut f64, op: &fn()) {
3636

3737
impl Results {
3838
pub fn bench_int<T:MutableSet<uint>,
39-
R: rand::Rng>(
40-
&mut self,
41-
rng: &mut R,
42-
num_keys: uint,
43-
rand_cap: uint,
44-
f: &fn() -> T) {
45-
{
39+
R: rand::Rng>(
40+
&mut self,
41+
rng: &mut R,
42+
num_keys: uint,
43+
rand_cap: uint,
44+
f: || -> T) { {
4645
let mut set = f();
4746
do timed(&mut self.sequential_ints) {
4847
for i in range(0u, num_keys) {
@@ -79,11 +78,11 @@ impl Results {
7978
}
8079

8180
pub fn bench_str<T:MutableSet<~str>,
82-
R:rand::Rng>(
83-
&mut self,
84-
rng: &mut R,
85-
num_keys: uint,
86-
f: &fn() -> T) {
81+
R:rand::Rng>(
82+
&mut self,
83+
rng: &mut R,
84+
num_keys: uint,
85+
f: || -> T) {
8786
{
8887
let mut set = f();
8988
do timed(&mut self.sequential_strings) {

src/test/bench/core-std.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() {
4040
bench!(argv, is_utf8_multibyte);
4141
}
4242

43-
fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
43+
fn maybe_run_test(argv: &[~str], name: ~str, test: ||) {
4444
let mut run_test = false;
4545

4646
if os::getenv("RUST_BENCH").is_some() {

src/test/bench/shootout-k-nucleotide-pipes.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ fn update_freq(mm: &mut HashMap<~[u8], uint>, key: &[u8]) {
104104
// given a ~[u8], for each window call a function
105105
// i.e., for "hello" and windows of size four,
106106
// run it("hell") and it("ello"), then return "llo"
107-
fn windows_with_carry(bb: &[u8], nn: uint,
108-
it: &fn(window: &[u8])) -> ~[u8] {
107+
fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> ~[u8] {
109108
let mut ii = 0u;
110109

111110
let len = bb.len();

src/test/bench/shootout-k-nucleotide.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl Table {
154154
}
155155
}
156156

157-
fn each(&self, f: &fn(entry: &Entry) -> bool) {
157+
fn each(&self, f: |entry: &Entry| -> bool) {
158158
for self.items.each |item| {
159159
match *item {
160160
None => {}

src/test/compile-fail/access-mode-in-closures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
struct sty(~[int]);
1313

14-
fn unpack(_unpack: &fn(v: &sty) -> ~[int]) {}
14+
fn unpack(_unpack: |v: &sty| -> ~[int]) {}
1515

1616
fn main() {
1717
let _foo = unpack(|s| {

src/test/compile-fail/block-coerce-no-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn main() {
1515
fn f(f: extern fn(extern fn(extern fn()))) {
1616
}
1717

18-
fn g(f: extern fn(&fn())) {
18+
fn g(f: extern fn(||)) {
1919
}
2020

2121
f(g);

0 commit comments

Comments
 (0)