diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-10 00:44:58 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-10 23:02:54 +1000 |
| commit | c32fb53cf9ae20a657d17bd8e2f0b36863096583 (patch) | |
| tree | 928280b4bfcde6b9765de76f956624a735eafde9 /src/test | |
| parent | b29cd22bce6325a60788ab84f989bd2e82fcaaf4 (diff) | |
| download | rust-c32fb53cf9ae20a657d17bd8e2f0b36863096583.tar.gz rust-c32fb53cf9ae20a657d17bd8e2f0b36863096583.zip | |
std: remove str::{len, slice, is_empty} in favour of methods.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/bench/shootout-fasta.rs | 10 | ||||
| -rw-r--r-- | src/test/bench/shootout-k-nucleotide-pipes.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/die-not-static.rs | 2 | ||||
| -rw-r--r-- | src/test/run-fail/task-spawn-barefn.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/string-self-append.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/utf8_chars.rs | 2 |
6 files changed, 11 insertions, 11 deletions
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index 9f125a48de9..c497a30ec5f 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -81,27 +81,27 @@ fn make_random_fasta(wr: @io::Writer, for uint::range(0u, n as uint) |_i| { str::push_char(&mut op, select_random(myrandom_next(rng, 100u32), copy genelist)); - if str::len(op) >= LINE_LENGTH() { + if op.len() >= LINE_LENGTH() { wr.write_line(op); op = ~""; } } - if str::len(op) > 0u { wr.write_line(op); } + if op.len() > 0u { wr.write_line(op); } } fn make_repeat_fasta(wr: @io::Writer, id: ~str, desc: ~str, s: ~str, n: int) { unsafe { wr.write_line(~">" + id + " " + desc); let mut op: ~str = ~""; - let sl: uint = str::len(s); + let sl: uint = s.len(); for uint::range(0u, n as uint) |i| { str::raw::push_byte(&mut op, s[i % sl]); - if str::len(op) >= LINE_LENGTH() { + if op.len() >= LINE_LENGTH() { wr.write_line(op); op = ~""; } } - if str::len(op) > 0u { wr.write_line(op); } + if op.len() > 0u { wr.write_line(op); } } } diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index e403ba6e73d..ef32b0bb2dc 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -191,7 +191,7 @@ fn main() { while !rdr.eof() { let line: ~str = rdr.read_line(); - if str::len(line) == 0u { loop; } + if line.len() == 0u { loop; } match (line[0] as char, proc_mode) { diff --git a/src/test/compile-fail/die-not-static.rs b/src/test/compile-fail/die-not-static.rs index c7f5e271818..40a4232717d 100644 --- a/src/test/compile-fail/die-not-static.rs +++ b/src/test/compile-fail/die-not-static.rs @@ -2,7 +2,7 @@ use std::str; fn main() { let v = ~"test"; - let sslice = str::slice(v, 0, v.len()); + let sslice = v.slice(0, v.len()); //~^ ERROR borrowed value does not live long enough fail!(sslice); } diff --git a/src/test/run-fail/task-spawn-barefn.rs b/src/test/run-fail/task-spawn-barefn.rs index 2456f968c3c..6e1af6ff7e0 100644 --- a/src/test/run-fail/task-spawn-barefn.rs +++ b/src/test/run-fail/task-spawn-barefn.rs @@ -20,5 +20,5 @@ fn main() { } fn startfn() { - assert!(str::is_empty(~"Ensure that the child task runs by failing")); + assert!("Ensure that the child task runs by failing".is_empty()); } diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs index f02600bb137..e01b2a42f61 100644 --- a/src/test/run-pass/string-self-append.rs +++ b/src/test/run-pass/string-self-append.rs @@ -18,8 +18,8 @@ pub fn main() { let mut i = 20; let mut expected_len = 1u; while i > 0 { - error!(str::len(a)); - assert_eq!(str::len(a), expected_len); + error!(a.len()); + assert_eq!(a.len(), expected_len); a = a + a; // FIXME(#3387)---can't write a += a i -= 1; expected_len *= 2u; diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs index 0069165aed4..011fb4435c3 100644 --- a/src/test/run-pass/utf8_chars.rs +++ b/src/test/run-pass/utf8_chars.rs @@ -18,7 +18,7 @@ pub fn main() { let chs: ~[char] = ~['e', 'é', '€', 0x10000 as char]; let s: ~str = str::from_chars(chs); - assert!(str::len(s) == 10u); + assert!(s.len() == 10u); assert!(str::char_len(s) == 4u); assert!(str::to_chars(s).len() == 4u); assert!(str::from_chars(str::to_chars(s)) == s); |
