Skip to content

Commit f2e2a14

Browse files
bstriebrson
authored andcommitted
Remove empty argument lists from do expressions
1 parent 718849b commit f2e2a14

Some content is hidden

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

62 files changed

+265
-265
lines changed

doc/rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ task in a _failing state_.
16381638
~~~~
16391639
# let buildr = task::builder();
16401640
# task::unsupervise(buildr);
1641-
# do task::run(buildr) || {
1641+
# do task::run(buildr) {
16421642
16431643
(~[1, 2, 3, 4])[0];
16441644
(~[mut 'x', 'y'])[1] = 'z';
@@ -3365,7 +3365,7 @@ An example of a `spawn` call:
33653365
let po = comm::port();
33663366
let ch = comm::chan(po);
33673367
3368-
do task::spawn || {
3368+
do task::spawn {
33693369
// let task run, do other things
33703370
// ...
33713371
comm::send(ch, true);

doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,7 +2473,7 @@ module `task`. Let's begin with the simplest one, `task::spawn()`:
24732473
24742474
~~~~
24752475
let some_value = 22;
2476-
do task::spawn || {
2476+
do task::spawn {
24772477
io::println("This executes in the child task.");
24782478
io::println(#fmt("%d", some_value));
24792479
}
@@ -2499,7 +2499,7 @@ in parallel. We might write something like:
24992499
# fn some_other_expensive_computation() {}
25002500
let port = comm::port::<int>();
25012501
let chan = comm::chan::<int>(port);
2502-
do task::spawn || {
2502+
do task::spawn {
25032503
let result = some_expensive_computation();
25042504
comm::send(chan, result);
25052505
}
@@ -2530,7 +2530,7 @@ The next statement actually spawns the child:
25302530
# fn some_expensive_computation() -> int { 42 }
25312531
# let port = comm::port::<int>();
25322532
# let chan = comm::chan::<int>(port);
2533-
do task::spawn || {
2533+
do task::spawn {
25342534
let result = some_expensive_computation();
25352535
comm::send(chan, result);
25362536
}

src/compiletest/procsrv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ fn run(lib_path: str,
6060
writeclose(pipe_in.out, input);
6161
let p = comm::port();
6262
let ch = comm::chan(p);
63-
do task::spawn_sched(task::single_threaded) || {
63+
do task::spawn_sched(task::single_threaded) {
6464
let errput = readclose(pipe_err.in);
6565
comm::send(ch, (2, errput));
6666
}
67-
do task::spawn_sched(task::single_threaded) || {
67+
do task::spawn_sched(task::single_threaded) {
6868
let output = readclose(pipe_out.in);
6969
comm::send(ch, (1, output));
7070
}

src/libcore/arc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ mod tests {
172172
let p = port();
173173
let c = chan(p);
174174

175-
do task::spawn() || {
175+
do task::spawn() {
176176
let p = port();
177177
c.send(chan(p));
178178

@@ -198,7 +198,7 @@ mod tests {
198198
let p = port();
199199
let c = chan(p);
200200

201-
do task::spawn() || {
201+
do task::spawn() {
202202
let arc_v = get_arc(arc_c);
203203
let v = *get(&arc_v);
204204
assert v[2] == 3;

src/libcore/comm.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class port_ptr<T:send> {
9898
let po: *rust_port;
9999
new(po: *rust_port) { self.po = po; }
100100
drop unsafe {
101-
do task::unkillable || {
101+
do task::unkillable {
102102
// Once the port is detached it's guaranteed not to receive further
103103
// messages
104104
let yield = 0u;
@@ -364,15 +364,15 @@ fn test_select2_rendezvous() {
364364
let ch_a = chan(po_a);
365365
let ch_b = chan(po_b);
366366

367-
for iter::repeat(10u) || {
368-
do task::spawn || {
367+
for iter::repeat(10u) {
368+
do task::spawn {
369369
for iter::repeat(10u) { task::yield() }
370370
send(ch_a, "a");
371371
};
372372

373373
assert select2(po_a, po_b) == either::left("a");
374374

375-
do task::spawn || {
375+
do task::spawn {
376376
for iter::repeat(10u) { task::yield() }
377377
send(ch_b, "b");
378378
};
@@ -391,22 +391,22 @@ fn test_select2_stress() {
391391
let msgs = 100u;
392392
let times = 4u;
393393

394-
for iter::repeat(times) || {
395-
do task::spawn || {
396-
for iter::repeat(msgs) || {
394+
for iter::repeat(times) {
395+
do task::spawn {
396+
for iter::repeat(msgs) {
397397
send(ch_a, "a")
398398
}
399399
};
400-
do task::spawn || {
401-
for iter::repeat(msgs) || {
400+
do task::spawn {
401+
for iter::repeat(msgs) {
402402
send(ch_b, "b")
403403
}
404404
};
405405
}
406406

407407
let mut as = 0;
408408
let mut bs = 0;
409-
for iter::repeat(msgs * times * 2u) || {
409+
for iter::repeat(msgs * times * 2u) {
410410
alt check select2(po_a, po_b) {
411411
either::left("a") { as += 1 }
412412
either::right("b") { bs += 1 }
@@ -463,7 +463,7 @@ fn test_chan_peek() {
463463
#[test]
464464
fn test_listen() {
465465
do listen |parent| {
466-
do task::spawn || {
466+
do task::spawn {
467467
parent.send("oatmeal-salad");
468468
}
469469
assert parent.recv() == "oatmeal-salad";
@@ -473,18 +473,18 @@ fn test_listen() {
473473
#[test]
474474
#[ignore(cfg(windows))]
475475
fn test_port_detach_fail() {
476-
for iter::repeat(100u) || {
476+
for iter::repeat(100u) {
477477
let builder = task::builder();
478478
task::unsupervise(builder);
479-
do task::run(builder) || {
479+
do task::run(builder) {
480480
let po = port();
481481
let ch = po.chan();
482482

483-
do task::spawn || {
483+
do task::spawn {
484484
fail;
485485
}
486486

487-
do task::spawn || {
487+
do task::spawn {
488488
ch.send(());
489489
}
490490
}

src/libcore/future.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn from_port<A:send>(-port: comm::port<A>) -> future<A> {
6464
waiting for the result to be received on the port.
6565
"];
6666

67-
do from_fn || {
67+
do from_fn {
6868
comm::recv(port)
6969
}
7070
}
@@ -93,7 +93,7 @@ fn spawn<A:send>(+blk: fn~() -> A) -> future<A> {
9393

9494
let mut po = comm::port();
9595
let ch = comm::chan(po);
96-
do task::spawn || {
96+
do task::spawn {
9797
comm::send(ch, blk())
9898
};
9999
from_port(po)

src/libcore/priv.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn test_from_global_chan1() {
121121
#[test]
122122
fn test_from_global_chan2() {
123123

124-
for iter::repeat(100u) || {
124+
for iter::repeat(100u) {
125125
// The global channel
126126
let globchan = 0u;
127127
let globchanp = ptr::addr_of(globchan);
@@ -132,7 +132,7 @@ fn test_from_global_chan2() {
132132
// Spawn a bunch of tasks that all want to compete to
133133
// create the global channel
134134
for uint::range(0u, 10u) |i| {
135-
do task::spawn || {
135+
do task::spawn {
136136
let ch = unsafe {
137137
do chan_from_global_ptr(
138138
globchanp, task::builder) |po| {
@@ -200,7 +200,7 @@ unsafe fn weaken_task(f: fn(comm::port<()>)) {
200200

201201
#[test]
202202
fn test_weaken_task_then_unweaken() {
203-
do task::try || {
203+
do task::try {
204204
unsafe {
205205
do weaken_task |_po| {
206206
}
@@ -212,7 +212,7 @@ fn test_weaken_task_then_unweaken() {
212212
fn test_weaken_task_wait() {
213213
let builder = task::builder();
214214
task::unsupervise(builder);
215-
do task::run(builder) || {
215+
do task::run(builder) {
216216
unsafe {
217217
do weaken_task |po| {
218218
comm::recv(po);
@@ -224,16 +224,16 @@ fn test_weaken_task_wait() {
224224
#[test]
225225
fn test_weaken_task_stress() {
226226
// Create a bunch of weak tasks
227-
for iter::repeat(100u) || {
228-
do task::spawn || {
227+
for iter::repeat(100u) {
228+
do task::spawn {
229229
unsafe {
230230
do weaken_task |_po| {
231231
}
232232
}
233233
}
234234
let builder = task::builder();
235235
task::unsupervise(builder);
236-
do task::run(builder) || {
236+
do task::run(builder) {
237237
unsafe {
238238
do weaken_task |po| {
239239
// Wait for it to tell us to die
@@ -247,7 +247,7 @@ fn test_weaken_task_stress() {
247247
#[test]
248248
#[ignore(cfg(windows))]
249249
fn test_weaken_task_fail() {
250-
let res = do task::try || {
250+
let res = do task::try {
251251
unsafe {
252252
do weaken_task |_po| {
253253
fail;

src/libcore/run.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,11 @@ fn program_output(prog: str, args: ~[str]) ->
298298
// clever way to do this.
299299
let p = comm::port();
300300
let ch = comm::chan(p);
301-
do task::spawn_sched(task::single_threaded) || {
301+
do task::spawn_sched(task::single_threaded) {
302302
let errput = readclose(pipe_err.in);
303303
comm::send(ch, (2, errput));
304304
};
305-
do task::spawn_sched(task::single_threaded) || {
305+
do task::spawn_sched(task::single_threaded) {
306306
let output = readclose(pipe_out.in);
307307
comm::send(ch, (1, output));
308308
};

0 commit comments

Comments
 (0)