diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-09-02 15:34:58 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-09-02 22:11:42 -0700 |
| commit | 5c49e4f4e92997869de1f75f9089c9db7e7a6ebe (patch) | |
| tree | 947f6d58da06e589a0ab0627319917a9d2352a8c /src/test/bench | |
| parent | b5f905342337a3dc12bdc5dc6d98d3ecdf60439d (diff) | |
| download | rust-5c49e4f4e92997869de1f75f9089c9db7e7a6ebe.tar.gz rust-5c49e4f4e92997869de1f75f9089c9db7e7a6ebe.zip | |
Reformat. Issue #855
Diffstat (limited to 'src/test/bench')
| -rw-r--r-- | src/test/bench/99bob-iter.rs | 26 | ||||
| -rw-r--r-- | src/test/bench/99bob-pattern.rs | 11 | ||||
| -rw-r--r-- | src/test/bench/99bob-simple.rs | 26 | ||||
| -rw-r--r-- | src/test/bench/99bob-tail.rs | 11 | ||||
| -rw-r--r-- | src/test/bench/shootout-fannkuchredux.rs | 2 | ||||
| -rw-r--r-- | src/test/bench/shootout-fasta.rs | 42 | ||||
| -rw-r--r-- | src/test/bench/shootout-pfib.rs | 13 | ||||
| -rw-r--r-- | src/test/bench/task-perf-spawnalot.rs | 6 | ||||
| -rw-r--r-- | src/test/bench/task-perf-vector-party.rs | 17 | ||||
| -rw-r--r-- | src/test/bench/task-perf-word-count-generic.rs | 58 | ||||
| -rw-r--r-- | src/test/bench/task-perf-word-count.rs | 50 |
11 files changed, 126 insertions, 136 deletions
diff --git a/src/test/bench/99bob-iter.rs b/src/test/bench/99bob-iter.rs index fea1420f8bb..a1a3e1b984a 100644 --- a/src/test/bench/99bob-iter.rs +++ b/src/test/bench/99bob-iter.rs @@ -8,28 +8,28 @@ use std; import std::int; import std::str; -fn b1() -> istr { ret ~"# of beer on the wall, # of beer."; } +fn b1() -> str { ret "# of beer on the wall, # of beer."; } -fn b2() -> istr { - ret ~"Take one down and pass it around, # of beer on the wall."; +fn b2() -> str { + ret "Take one down and pass it around, # of beer on the wall."; } -fn b7() -> istr { - ret ~"No more bottles of beer on the wall, no more bottles of beer."; +fn b7() -> str { + ret "No more bottles of beer on the wall, no more bottles of beer."; } -fn b8() -> istr { - ret ~"Go to the store and buy some more, # of beer on the wall."; +fn b8() -> str { + ret "Go to the store and buy some more, # of beer on the wall."; } -fn sub(t: &istr, n: int) -> istr { - let b: istr = ~""; +fn sub(t: &str, n: int) -> str { + let b: str = ""; let i: uint = 0u; - let ns: istr; + let ns: str; alt n { - 0 { ns = ~"no more bottles"; } - 1 { ns = ~"1 bottle"; } - _ { ns = int::to_str(n, 10u) + ~" bottles"; } + 0 { ns = "no more bottles"; } + 1 { ns = "1 bottle"; } + _ { ns = int::to_str(n, 10u) + " bottles"; } } while i < str::byte_len(t) { if t[i] == '#' as u8 { b += ns; } else { str::push_byte(b, t[i]); } diff --git a/src/test/bench/99bob-pattern.rs b/src/test/bench/99bob-pattern.rs index a13015fb4f7..fdfce9dfae5 100644 --- a/src/test/bench/99bob-pattern.rs +++ b/src/test/bench/99bob-pattern.rs @@ -29,12 +29,11 @@ fn show(b: bottle) { "1 bottle of beer on the wall."; } multiple(n) { - let nb: istr = int::to_str(n, 10u); - let mb: istr = int::to_str(n - 1, 10u); - log nb + ~" bottles of beer on the wall, " + nb + - ~" bottles of beer,"; - log ~"Take one down and pass it around, " + mb + - ~" bottles of beer on the wall."; + let nb: str = int::to_str(n, 10u); + let mb: str = int::to_str(n - 1, 10u); + log nb + " bottles of beer on the wall, " + nb + " bottles of beer,"; + log "Take one down and pass it around, " + mb + + " bottles of beer on the wall."; } } } diff --git a/src/test/bench/99bob-simple.rs b/src/test/bench/99bob-simple.rs index 30518c63e2d..ae1c30fb9ec 100644 --- a/src/test/bench/99bob-simple.rs +++ b/src/test/bench/99bob-simple.rs @@ -8,28 +8,28 @@ use std; import std::int; import std::str; -fn b1() -> istr { ret ~"# of beer on the wall, # of beer."; } +fn b1() -> str { ret "# of beer on the wall, # of beer."; } -fn b2() -> istr { - ret ~"Take one down and pass it around, # of beer on the wall."; +fn b2() -> str { + ret "Take one down and pass it around, # of beer on the wall."; } -fn b7() -> istr { - ret ~"No more bottles of beer on the wall, no more bottles of beer."; +fn b7() -> str { + ret "No more bottles of beer on the wall, no more bottles of beer."; } -fn b8() -> istr { - ret ~"Go to the store and buy some more, # of beer on the wall."; +fn b8() -> str { + ret "Go to the store and buy some more, # of beer on the wall."; } -fn sub(t: &istr, n: int) -> istr { - let b: istr = ~""; +fn sub(t: &str, n: int) -> str { + let b: str = ""; let i: uint = 0u; - let ns: istr; + let ns: str; alt n { - 0 { ns = ~"no more bottles"; } - 1 { ns = ~"1 bottle"; } - _ { ns = int::to_str(n, 10u) + ~" bottles"; } + 0 { ns = "no more bottles"; } + 1 { ns = "1 bottle"; } + _ { ns = int::to_str(n, 10u) + " bottles"; } } while i < str::byte_len(t) { if t[i] == '#' as u8 { b += ns; } else { str::push_byte(b, t[i]); } diff --git a/src/test/bench/99bob-tail.rs b/src/test/bench/99bob-tail.rs index 9ab8973cbce..af5e22f48ea 100644 --- a/src/test/bench/99bob-tail.rs +++ b/src/test/bench/99bob-tail.rs @@ -8,12 +8,11 @@ import std::str; fn main() { fn multiple(n: int) { - let nb: istr = int::to_str(n, 10u); - let mb: istr = int::to_str(n - 1, 10u); - log nb + ~" bottles of beer on the wall, " + nb + - ~" bottles of beer,"; - log ~"Take one down and pass it around, " + mb + - ~" bottles of beer on the wall."; + let nb: str = int::to_str(n, 10u); + let mb: str = int::to_str(n - 1, 10u); + log nb + " bottles of beer on the wall, " + nb + " bottles of beer,"; + log "Take one down and pass it around, " + mb + + " bottles of beer on the wall."; log ""; if n > 3 { be multiple(n - 1); } else { be dual(); } } diff --git a/src/test/bench/shootout-fannkuchredux.rs b/src/test/bench/shootout-fannkuchredux.rs index fa4a17180ae..8e7b2cbe269 100644 --- a/src/test/bench/shootout-fannkuchredux.rs +++ b/src/test/bench/shootout-fannkuchredux.rs @@ -56,7 +56,7 @@ fn fannkuch(n: int) -> int { ret flips; } -fn main(args: [istr]) { +fn main(args: [str]) { let n = 7; log #fmt["Pfannkuchen(%d) = %d", n, fannkuch(n)]; } diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index cd29838b378..99b06a98416 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -43,32 +43,31 @@ fn select_random(r: u32, genelist: &[aminoacids]) -> char { ret bisect(genelist, 0u, vec::len::<aminoacids>(genelist) - 1u, r); } -fn make_random_fasta(id: &istr, desc: &istr, - genelist: &[aminoacids], n: int) { - log ~">" + id + ~" " + desc; +fn make_random_fasta(id: &str, desc: &str, genelist: &[aminoacids], n: int) { + log ">" + id + " " + desc; let rng = myrandom(std::rand::mk_rng().next()); - let op: istr = ~""; + let op: str = ""; for each i: uint in uint::range(0u, n as uint) { str::push_byte(op, select_random(rng.next(100u32), genelist) as u8); - if str::byte_len(op) >= LINE_LENGTH() { log op; op = ~""; } + if str::byte_len(op) >= LINE_LENGTH() { log op; op = ""; } } if str::byte_len(op) > 0u { log op; } } -fn make_repeat_fasta(id: &istr, desc: &istr, s: &istr, n: int) { - log ~">" + id + ~" " + desc; - let op: istr = ~""; +fn make_repeat_fasta(id: &str, desc: &str, s: &str, n: int) { + log ">" + id + " " + desc; + let op: str = ""; let sl: uint = str::byte_len(s); for each i: uint in uint::range(0u, n as uint) { str::push_byte(op, s[i % sl]); - if str::byte_len(op) >= LINE_LENGTH() { log op; op = ~""; } + if str::byte_len(op) >= LINE_LENGTH() { log op; op = ""; } } if str::byte_len(op) > 0u { log op; } } fn acid(ch: char, prob: u32) -> aminoacids { ret {ch: ch, prob: prob}; } -fn main(args: [istr]) { +fn main(args: [str]) { let iub: [aminoacids] = make_cumulative([acid('a', 27u32), acid('c', 12u32), acid('g', 12u32), acid('t', 27u32), acid('B', 2u32), acid('D', 2u32), @@ -78,17 +77,16 @@ fn main(args: [istr]) { let homosapiens: [aminoacids] = make_cumulative([acid('a', 30u32), acid('c', 20u32), acid('g', 20u32), acid('t', 30u32)]); - let alu: istr = - ~"GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" + - ~"GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" + - ~"CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" + - ~"ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" + - ~"GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" + - ~"AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" + - ~"AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"; + let alu: str = + "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" + + "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" + + "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" + + "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" + + "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" + + "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" + + "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"; let n: int = 512; - make_repeat_fasta(~"ONE", ~"Homo sapiens alu", alu, n * 2); - make_random_fasta(~"TWO", ~"IUB ambiguity codes", iub, n * 3); - make_random_fasta(~"THREE", ~"Homo sapiens frequency", - homosapiens, n * 5); + make_repeat_fasta("ONE", "Homo sapiens alu", alu, n * 2); + make_random_fasta("TWO", "IUB ambiguity codes", iub, n * 3); + make_random_fasta("THREE", "Homo sapiens frequency", homosapiens, n * 5); } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 6a9a5348c2e..9551aa6b982 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -49,14 +49,14 @@ fn fib(n: int) -> int { type config = {stress: bool}; -fn parse_opts(argv: &[istr]) -> config { - let opts = [getopts::optflag(~"stress")]; +fn parse_opts(argv: &[str]) -> config { + let opts = [getopts::optflag("stress")]; let opt_args = vec::slice(argv, 1u, vec::len(argv)); alt getopts::getopts(opt_args, opts) { - getopts::success(m) { ret {stress: getopts::opt_present(m, ~"stress")} } + getopts::success(m) { ret {stress: getopts::opt_present(m, "stress")} } getopts::failure(_) { fail; } } } @@ -79,7 +79,7 @@ fn stress(num_tasks: int) { for t in tasks { task::join(t); } } -fn main(argv: [istr]) { +fn main(argv: [str]) { if vec::len(argv) == 1u { assert (fib(8) == 21); log fib(8); @@ -105,9 +105,8 @@ fn main(argv: [istr]) { let elapsed = stop - start; - out.write_line( - #fmt["%d\t%d\t%s", n, fibn, - u64::str(elapsed)]); + out.write_line(#fmt["%d\t%d\t%s", n, fibn, + u64::str(elapsed)]); } } } diff --git a/src/test/bench/task-perf-spawnalot.rs b/src/test/bench/task-perf-spawnalot.rs index 941f0183031..ebe1abc493b 100644 --- a/src/test/bench/task-perf-spawnalot.rs +++ b/src/test/bench/task-perf-spawnalot.rs @@ -8,12 +8,14 @@ fn f(n: uint) { let i = 0u; while i < n { let thunk = g; - task::join(task::spawn_joinable(thunk)); i += 1u; } + task::join(task::spawn_joinable(thunk)); + i += 1u; + } } fn g() { } -fn main(args: [istr]) { +fn main(args: [str]) { let n = if vec::len(args) < 2u { 10u diff --git a/src/test/bench/task-perf-vector-party.rs b/src/test/bench/task-perf-vector-party.rs index fd650df660b..b70bd24828a 100644 --- a/src/test/bench/task-perf-vector-party.rs +++ b/src/test/bench/task-perf-vector-party.rs @@ -16,13 +16,10 @@ fn f(n: uint) { } } -fn main(args: [istr]) { - let n = if vec::len(args) < 2u { - 100u - } else { - uint::parse_buf(str::bytes(args[1]), 10u) - }; - for each i in uint::range(0u, 100u) { - task::spawn(bind f(n)); - } -} \ No newline at end of file +fn main(args: [str]) { + let n = + if vec::len(args) < 2u { + 100u + } else { uint::parse_buf(str::bytes(args[1]), 10u) }; + for each i in uint::range(0u, 100u) { task::spawn(bind f(n)); } +} diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index 3a8f643bc37..adb5040fa25 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -70,9 +70,10 @@ mod map_reduce { tag reduce_proto<~V> { emit_val(V); done; ref; release; } - fn start_mappers<~K1, ~K2, ~V>(map : mapper<K1, K2, V>, - ctrl: chan<ctrl_proto<K2, V>>, inputs: &[K1]) - -> [joinable_task] { + fn start_mappers<~K1, ~K2, + ~V>(map: mapper<K1, K2, V>, + ctrl: chan<ctrl_proto<K2, V>>, inputs: &[K1]) -> + [joinable_task] { let tasks = []; for i in inputs { let m = map, c = ctrl, ii = i; @@ -81,18 +82,18 @@ mod map_reduce { ret tasks; } - fn map_task<~K1, ~K2, ~V>(map : -mapper<K1,K2,V>, - ctrl: -chan<ctrl_proto<K2,V>>, input: -K1) { + fn map_task<~K1, ~K2, + ~V>(map: -mapper<K1, K2, V>, ctrl: -chan<ctrl_proto<K2, V>>, + input: -K1) { // log_err "map_task " + input; let intermediates = treemap::init(); - fn emit<~K2, ~V>(im: &treemap::treemap<K2, chan<reduce_proto<V>>>, - ctrl: &chan<ctrl_proto<K2,V>>, key: &K2, val: &V) { + fn emit<~K2, + ~V>(im: &treemap::treemap<K2, chan<reduce_proto<V>>>, + ctrl: &chan<ctrl_proto<K2, V>>, key: &K2, val: &V) { let c; alt treemap::find(im, key) { - some(_c) { - c = _c - } + some(_c) { c = _c } none. { let p = port(); send(ctrl, find_reducer(key, chan(p))); @@ -106,15 +107,16 @@ mod map_reduce { map(input, bind emit(intermediates, ctrl, _, _)); - fn finish<~K, ~V>(k : &K, v : &chan<reduce_proto<V>>) { + fn finish<~K, ~V>(k: &K, v: &chan<reduce_proto<V>>) { send(v, release); } treemap::traverse(intermediates, finish); send(ctrl, mapper_done); } - fn reduce_task<~K, ~V>(reduce : -reducer<K,V>, - key: -K, out: -chan<chan<reduce_proto<V>>>) { + fn reduce_task<~K, + ~V>(reduce: -reducer<K, V>, key: -K, + out: -chan<chan<reduce_proto<V>>>) { let p = port(); send(out, chan(p)); @@ -123,7 +125,7 @@ mod map_reduce { let is_done = false; fn get<~V>(p: &port<reduce_proto<V>>, ref_count: &mutable int, - is_done: &mutable bool) -> option<V> { + is_done: &mutable bool) -> option<V> { while !is_done || ref_count > 0 { alt recv(p) { emit_val(v) { @@ -144,9 +146,9 @@ mod map_reduce { reduce(key, bind get(p, ref_count, is_done)); } - fn map_reduce<~K1, ~K2, ~V>(map : mapper<K1,K2,V>, - reduce : reducer<K2, V>, - inputs: &[K1]) { + fn map_reduce<~K1, ~K2, + ~V>(map: mapper<K1, K2, V>, reduce: reducer<K2, V>, + inputs: &[K1]) { let ctrl = port(); // This task becomes the master control task. It task::_spawns @@ -177,8 +179,8 @@ mod map_reduce { let p = port(); let r = reduce, kk = k; tasks += - [task::spawn_joinable(bind reduce_task(r, - kk, chan(p)))]; + [task::spawn_joinable(bind reduce_task(r, kk, + chan(p)))]; c = recv(p); treemap::insert(reducers, k, c); } @@ -188,21 +190,18 @@ mod map_reduce { } } - fn finish<~K, ~V>(k : &K, v : &chan<reduce_proto<V>>) { - send(v, done); - } + fn finish<~K, ~V>(k: &K, v: &chan<reduce_proto<V>>) { send(v, done); } treemap::traverse(reducers, finish); for t in tasks { task::join(t); } } } -fn main(argv: [istr]) { +fn main(argv: [str]) { if vec::len(argv) < 2u { let out = io::stdout(); - out.write_line( - #fmt["Usage: %s <filename> ...", argv[0]]); + out.write_line(#fmt["Usage: %s <filename> ...", argv[0]]); // TODO: run something just to make sure the code hasn't // broken yet. This is the unit test mode of this program. @@ -227,12 +226,11 @@ fn main(argv: [istr]) { let elapsed = stop - start; elapsed /= 1000000u64; - log_err ~"MapReduce completed in " + - u64::str(elapsed) + ~"ms"; + log_err "MapReduce completed in " + u64::str(elapsed) + "ms"; } -fn read_word(r: io::reader) -> option<istr> { - let w = ~""; +fn read_word(r: io::reader) -> option<str> { + let w = ""; while !r.eof() { let c = r.read_char(); @@ -240,7 +238,7 @@ fn read_word(r: io::reader) -> option<istr> { if is_word_char(c) { w += str::from_char(c); - } else { if w != ~"" { ret some(w); } } + } else { if w != "" { ret some(w); } } } ret none; } diff --git a/src/test/bench/task-perf-word-count.rs b/src/test/bench/task-perf-word-count.rs index c62ebc73b5d..a90abd9e526 100644 --- a/src/test/bench/task-perf-word-count.rs +++ b/src/test/bench/task-perf-word-count.rs @@ -29,7 +29,7 @@ import std::comm::port; import std::comm::recv; import std::comm::send; -fn map(filename: &istr, emit: map_reduce::putter) { +fn map(filename: &str, emit: map_reduce::putter) { let f = io::file_reader(filename); @@ -38,7 +38,7 @@ fn map(filename: &istr, emit: map_reduce::putter) { } } -fn reduce(word: &istr, get: map_reduce::getter) { +fn reduce(word: &str, get: map_reduce::getter) { let count = 0; @@ -52,36 +52,36 @@ mod map_reduce { export reducer; export map_reduce; - type putter = fn(&istr, int); + type putter = fn(&str, int); - type mapper = fn(&istr, putter); + type mapper = fn(&str, putter); type getter = fn() -> option<int>; - type reducer = fn(&istr, getter); + type reducer = fn(&str, getter); tag ctrl_proto { - find_reducer(istr, chan<chan<reduce_proto>>); + find_reducer(str, chan<chan<reduce_proto>>); mapper_done; } tag reduce_proto { emit_val(int); done; ref; release; } - fn start_mappers(ctrl: chan<ctrl_proto>, inputs: &[istr]) - -> [joinable_task] { + fn start_mappers(ctrl: chan<ctrl_proto>, inputs: &[str]) -> + [joinable_task] { let tasks = []; - for i: istr in inputs { + for i: str in inputs { tasks += [task::spawn_joinable(bind map_task(ctrl, i))]; } ret tasks; } - fn map_task(ctrl: chan<ctrl_proto>, input: &istr) { + fn map_task(ctrl: chan<ctrl_proto>, input: &str) { // log_err "map_task " + input; let intermediates = map::new_str_hash(); - fn emit(im: &map::hashmap<istr, chan<reduce_proto>>, - ctrl: chan<ctrl_proto>, key: &istr, val: int) { + fn emit(im: &map::hashmap<str, chan<reduce_proto>>, + ctrl: chan<ctrl_proto>, key: &str, val: int) { let c; alt im.find(key) { some(_c) { @@ -101,7 +101,7 @@ mod map_reduce { map(input, bind emit(intermediates, ctrl, _, _)); - for each kv: @{key: istr, val: chan<reduce_proto>} in + for each kv: @{key: str, val: chan<reduce_proto>} in intermediates.items() { send(kv.val, release); } @@ -109,7 +109,7 @@ mod map_reduce { send(ctrl, mapper_done); } - fn reduce_task(key: &istr, out: chan<chan<reduce_proto>>) { + fn reduce_task(key: &str, out: chan<chan<reduce_proto>>) { let p = port(); send(out, chan(p)); @@ -139,13 +139,13 @@ mod map_reduce { reduce(key, bind get(p, ref_count, is_done)); } - fn map_reduce(inputs: &[istr]) { + fn map_reduce(inputs: &[str]) { let ctrl = port::<ctrl_proto>(); // This task becomes the master control task. It task::_spawns // to do the rest. - let reducers: map::hashmap<istr, chan<reduce_proto>>; + let reducers: map::hashmap<str, chan<reduce_proto>>; reducers = map::new_str_hash(); @@ -171,8 +171,7 @@ mod map_reduce { // log_err "creating new reducer for " + k; let p = port(); tasks += - [task::spawn_joinable( - bind reduce_task(k, chan(p)))]; + [task::spawn_joinable(bind reduce_task(k, chan(p)))]; c = recv(p); reducers.insert(k, c); } @@ -182,7 +181,7 @@ mod map_reduce { } } - for each kv: @{key: istr, val: chan<reduce_proto>} in reducers.items() + for each kv: @{key: str, val: chan<reduce_proto>} in reducers.items() { send(kv.val, done); } @@ -191,12 +190,11 @@ mod map_reduce { } } -fn main(argv: [istr]) { +fn main(argv: [str]) { if vec::len(argv) < 2u { let out = io::stdout(); - out.write_line( - #fmt["Usage: %s <filename> ...", argv[0]]); + out.write_line(#fmt["Usage: %s <filename> ...", argv[0]]); // TODO: run something just to make sure the code hasn't // broken yet. This is the unit test mode of this program. @@ -216,11 +214,11 @@ fn main(argv: [istr]) { let elapsed = stop - start; elapsed /= 1000000u64; - log_err ~"MapReduce completed in " + u64::str(elapsed) + ~"ms"; + log_err "MapReduce completed in " + u64::str(elapsed) + "ms"; } -fn read_word(r: io::reader) -> option<istr> { - let w = ~""; +fn read_word(r: io::reader) -> option<str> { + let w = ""; while !r.eof() { let c = r.read_char(); @@ -228,7 +226,7 @@ fn read_word(r: io::reader) -> option<istr> { if is_word_char(c) { w += str::from_char(c); - } else { if w != ~"" { ret some(w); } } + } else { if w != "" { ret some(w); } } } ret none; } |
