Skip to content

Commit

Permalink
Remove empty argument lists from do expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
bstrie authored and brson committed Jul 5, 2012
1 parent 718849b commit f2e2a14
Show file tree
Hide file tree
Showing 62 changed files with 265 additions and 265 deletions.
4 changes: 2 additions & 2 deletions doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ task in a _failing state_.
~~~~
# let buildr = task::builder();
# task::unsupervise(buildr);
# do task::run(buildr) || {
# do task::run(buildr) {
(~[1, 2, 3, 4])[0];
(~[mut 'x', 'y'])[1] = 'z';
Expand Down Expand Up @@ -3365,7 +3365,7 @@ An example of a `spawn` call:
let po = comm::port();
let ch = comm::chan(po);
do task::spawn || {
do task::spawn {
// let task run, do other things
// ...
comm::send(ch, true);
Expand Down
6 changes: 3 additions & 3 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -2473,7 +2473,7 @@ module `task`. Let's begin with the simplest one, `task::spawn()`:

~~~~
let some_value = 22;
do task::spawn || {
do task::spawn {
io::println("This executes in the child task.");
io::println(#fmt("%d", some_value));
}
Expand All @@ -2499,7 +2499,7 @@ in parallel. We might write something like:
# fn some_other_expensive_computation() {}
let port = comm::port::<int>();
let chan = comm::chan::<int>(port);
do task::spawn || {
do task::spawn {
let result = some_expensive_computation();
comm::send(chan, result);
}
Expand Down Expand Up @@ -2530,7 +2530,7 @@ The next statement actually spawns the child:
# fn some_expensive_computation() -> int { 42 }
# let port = comm::port::<int>();
# let chan = comm::chan::<int>(port);
do task::spawn || {
do task::spawn {
let result = some_expensive_computation();
comm::send(chan, result);
}
Expand Down
4 changes: 2 additions & 2 deletions src/compiletest/procsrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ fn run(lib_path: str,
writeclose(pipe_in.out, input);
let p = comm::port();
let ch = comm::chan(p);
do task::spawn_sched(task::single_threaded) || {
do task::spawn_sched(task::single_threaded) {
let errput = readclose(pipe_err.in);
comm::send(ch, (2, errput));
}
do task::spawn_sched(task::single_threaded) || {
do task::spawn_sched(task::single_threaded) {
let output = readclose(pipe_out.in);
comm::send(ch, (1, output));
}
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ mod tests {
let p = port();
let c = chan(p);

do task::spawn() || {
do task::spawn() {
let p = port();
c.send(chan(p));

Expand All @@ -198,7 +198,7 @@ mod tests {
let p = port();
let c = chan(p);

do task::spawn() || {
do task::spawn() {
let arc_v = get_arc(arc_c);
let v = *get(&arc_v);
assert v[2] == 3;
Expand Down
30 changes: 15 additions & 15 deletions src/libcore/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class port_ptr<T:send> {
let po: *rust_port;
new(po: *rust_port) { self.po = po; }
drop unsafe {
do task::unkillable || {
do task::unkillable {
// Once the port is detached it's guaranteed not to receive further
// messages
let yield = 0u;
Expand Down Expand Up @@ -364,15 +364,15 @@ fn test_select2_rendezvous() {
let ch_a = chan(po_a);
let ch_b = chan(po_b);

for iter::repeat(10u) || {
do task::spawn || {
for iter::repeat(10u) {
do task::spawn {
for iter::repeat(10u) { task::yield() }
send(ch_a, "a");
};

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

do task::spawn || {
do task::spawn {
for iter::repeat(10u) { task::yield() }
send(ch_b, "b");
};
Expand All @@ -391,22 +391,22 @@ fn test_select2_stress() {
let msgs = 100u;
let times = 4u;

for iter::repeat(times) || {
do task::spawn || {
for iter::repeat(msgs) || {
for iter::repeat(times) {
do task::spawn {
for iter::repeat(msgs) {
send(ch_a, "a")
}
};
do task::spawn || {
for iter::repeat(msgs) || {
do task::spawn {
for iter::repeat(msgs) {
send(ch_b, "b")
}
};
}

let mut as = 0;
let mut bs = 0;
for iter::repeat(msgs * times * 2u) || {
for iter::repeat(msgs * times * 2u) {
alt check select2(po_a, po_b) {
either::left("a") { as += 1 }
either::right("b") { bs += 1 }
Expand Down Expand Up @@ -463,7 +463,7 @@ fn test_chan_peek() {
#[test]
fn test_listen() {
do listen |parent| {
do task::spawn || {
do task::spawn {
parent.send("oatmeal-salad");
}
assert parent.recv() == "oatmeal-salad";
Expand All @@ -473,18 +473,18 @@ fn test_listen() {
#[test]
#[ignore(cfg(windows))]
fn test_port_detach_fail() {
for iter::repeat(100u) || {
for iter::repeat(100u) {
let builder = task::builder();
task::unsupervise(builder);
do task::run(builder) || {
do task::run(builder) {
let po = port();
let ch = po.chan();

do task::spawn || {
do task::spawn {
fail;
}

do task::spawn || {
do task::spawn {
ch.send(());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn from_port<A:send>(-port: comm::port<A>) -> future<A> {
waiting for the result to be received on the port.
"];

do from_fn || {
do from_fn {
comm::recv(port)
}
}
Expand Down Expand Up @@ -93,7 +93,7 @@ fn spawn<A:send>(+blk: fn~() -> A) -> future<A> {

let mut po = comm::port();
let ch = comm::chan(po);
do task::spawn || {
do task::spawn {
comm::send(ch, blk())
};
from_port(po)
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/priv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fn test_from_global_chan1() {
#[test]
fn test_from_global_chan2() {

for iter::repeat(100u) || {
for iter::repeat(100u) {
// The global channel
let globchan = 0u;
let globchanp = ptr::addr_of(globchan);
Expand All @@ -132,7 +132,7 @@ fn test_from_global_chan2() {
// Spawn a bunch of tasks that all want to compete to
// create the global channel
for uint::range(0u, 10u) |i| {
do task::spawn || {
do task::spawn {
let ch = unsafe {
do chan_from_global_ptr(
globchanp, task::builder) |po| {
Expand Down Expand Up @@ -200,7 +200,7 @@ unsafe fn weaken_task(f: fn(comm::port<()>)) {

#[test]
fn test_weaken_task_then_unweaken() {
do task::try || {
do task::try {
unsafe {
do weaken_task |_po| {
}
Expand All @@ -212,7 +212,7 @@ fn test_weaken_task_then_unweaken() {
fn test_weaken_task_wait() {
let builder = task::builder();
task::unsupervise(builder);
do task::run(builder) || {
do task::run(builder) {
unsafe {
do weaken_task |po| {
comm::recv(po);
Expand All @@ -224,16 +224,16 @@ fn test_weaken_task_wait() {
#[test]
fn test_weaken_task_stress() {
// Create a bunch of weak tasks
for iter::repeat(100u) || {
do task::spawn || {
for iter::repeat(100u) {
do task::spawn {
unsafe {
do weaken_task |_po| {
}
}
}
let builder = task::builder();
task::unsupervise(builder);
do task::run(builder) || {
do task::run(builder) {
unsafe {
do weaken_task |po| {
// Wait for it to tell us to die
Expand All @@ -247,7 +247,7 @@ fn test_weaken_task_stress() {
#[test]
#[ignore(cfg(windows))]
fn test_weaken_task_fail() {
let res = do task::try || {
let res = do task::try {
unsafe {
do weaken_task |_po| {
fail;
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@ fn program_output(prog: str, args: ~[str]) ->
// clever way to do this.
let p = comm::port();
let ch = comm::chan(p);
do task::spawn_sched(task::single_threaded) || {
do task::spawn_sched(task::single_threaded) {
let errput = readclose(pipe_err.in);
comm::send(ch, (2, errput));
};
do task::spawn_sched(task::single_threaded) || {
do task::spawn_sched(task::single_threaded) {
let output = readclose(pipe_out.in);
comm::send(ch, (1, output));
};
Expand Down
Loading

0 comments on commit f2e2a14

Please sign in to comment.