Skip to content

Commit 579eb24

Browse files
pcwaltonhuonw
authored andcommitted
test: Automatically remove all ~[T] from tests.
1 parent 0b714b4 commit 579eb24

File tree

247 files changed

+628
-642
lines changed

Some content is hidden

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

247 files changed

+628
-642
lines changed

src/test/auxiliary/anon-extern-mod-cross-crate-1.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
use std::libc;
1414

15+
use std::vec_ng::Vec;
1516
#[link(name="rustrt")]
1617
extern {
1718
pub fn rust_get_test_int() -> libc::intptr_t;

src/test/auxiliary/cci_class_6.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010

1111
pub mod kitties {
1212
pub struct cat<U> {
13-
priv info : ~[U],
13+
priv info : Vec<U> ,
1414
priv meows : uint,
1515

1616
how_hungry : int,
1717
}
1818

1919
impl<U> cat<U> {
20-
pub fn speak<T>(&mut self, stuff: ~[T]) {
20+
pub fn speak<T>(&mut self, stuff: Vec<T> ) {
2121
self.meows += stuff.len();
2222
}
2323

2424
pub fn meow_count(&mut self) -> uint { self.meows }
2525
}
2626

27-
pub fn cat<U>(in_x : uint, in_y : int, in_info: ~[U]) -> cat<U> {
27+
pub fn cat<U>(in_x : uint, in_y : int, in_info: Vec<U> ) -> cat<U> {
2828
cat {
2929
meows: in_x,
3030
how_hungry: in_y,

src/test/auxiliary/cci_nested_lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub struct Entry<A,B> {
1919

2020
pub struct alist<A,B> {
2121
eq_fn: extern "Rust" fn(A,A) -> bool,
22-
data: @RefCell<~[Entry<A,B>]>,
22+
data: @RefCell<Vec<Entry<A,B>> >,
2323
}
2424

2525
pub fn alist_add<A:'static,B:'static>(lst: &alist<A,B>, k: A, v: B) {
@@ -47,7 +47,7 @@ pub fn new_int_alist<B:'static>() -> alist<int, B> {
4747
fn eq_int(a: int, b: int) -> bool { a == b }
4848
return alist {
4949
eq_fn: eq_int,
50-
data: @RefCell::new(~[]),
50+
data: @RefCell::new(Vec::new()),
5151
};
5252
}
5353

@@ -57,6 +57,6 @@ pub fn new_int_alist_2<B:'static>() -> alist<int, B> {
5757
fn eq_int(a: int, b: int) -> bool { a == b }
5858
return alist {
5959
eq_fn: eq_int,
60-
data: @RefCell::new(~[]),
60+
data: @RefCell::new(Vec::new()),
6161
};
6262
}

src/test/auxiliary/cci_no_inline_lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#[crate_id="cci_no_inline_lib"];
1212

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

src/test/auxiliary/issue-2631-a.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern crate collections;
1717
use std::cell::RefCell;
1818
use collections::HashMap;
1919

20-
pub type header_map = HashMap<~str, @RefCell<~[@~str]>>;
20+
pub type header_map = HashMap<~str, @RefCell<vec!(@~str)>>;
2121

2222
// the unused ty param is necessary so this gets monomorphized
2323
pub fn request<T>(req: &header_map) {

src/test/auxiliary/issue_2723_a.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub unsafe fn f(xs: ~[int]) {
11+
pub unsafe fn f(xs: Vec<int> ) {
1212
xs.map(|_x| { unsafe fn q() { fail!(); } });
1313
}

src/test/bench/core-std.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use std::mem::swap;
2121
use std::os;
2222
use std::str;
2323
use std::slice;
24+
use std::vec;
2425
use std::io::File;
2526

2627
macro_rules! bench (
@@ -61,8 +62,8 @@ fn maybe_run_test(argv: &[~str], name: ~str, test: ||) {
6162
}
6263

6364
fn shift_push() {
64-
let mut v1 = slice::from_elem(30000, 1);
65-
let mut v2 = ~[];
65+
let mut v1 = Vec::from_elem(30000, 1);
66+
let mut v2 = Vec::new();
6667

6768
while v1.len() > 0 {
6869
v2.push(v1.shift().unwrap());
@@ -85,7 +86,7 @@ fn read_line() {
8586
fn vec_plus() {
8687
let mut r = rand::task_rng();
8788

88-
let mut v = ~[];
89+
let mut v = Vec::new();
8990
let mut i = 0;
9091
while i < 1500 {
9192
let rv = slice::from_elem(r.gen_range(0u, i + 1), i);
@@ -101,15 +102,15 @@ fn vec_plus() {
101102
fn vec_append() {
102103
let mut r = rand::task_rng();
103104

104-
let mut v = ~[];
105+
let mut v = Vec::new();
105106
let mut i = 0;
106107
while i < 1500 {
107108
let rv = slice::from_elem(r.gen_range(0u, i + 1), i);
108109
if r.gen() {
109-
v = slice::append(v, rv);
110+
v = vec::append(v, rv);
110111
}
111112
else {
112-
v = slice::append(rv, v);
113+
v = vec::append(rv, v);
113114
}
114115
i += 1;
115116
}
@@ -118,7 +119,7 @@ fn vec_append() {
118119
fn vec_push_all() {
119120
let mut r = rand::task_rng();
120121

121-
let mut v = ~[];
122+
let mut v = Vec::new();
122123
for i in range(0u, 1500) {
123124
let mut rv = slice::from_elem(r.gen_range(0u, i + 1), i);
124125
if r.gen() {
@@ -132,7 +133,7 @@ fn vec_push_all() {
132133
}
133134

134135
fn is_utf8_ascii() {
135-
let mut v : ~[u8] = ~[];
136+
let mut v : Vec<u8> = Vec::new();
136137
for _ in range(0u, 20000) {
137138
v.push('b' as u8);
138139
if !str::is_utf8(v) {
@@ -143,7 +144,7 @@ fn is_utf8_ascii() {
143144

144145
fn is_utf8_multibyte() {
145146
let s = "b¢€𤭢";
146-
let mut v : ~[u8]= ~[];
147+
let mut v : Vec<u8> = Vec::new();
147148
for _ in range(0u, 5000) {
148149
v.push_all(s.as_bytes());
149150
if !str::is_utf8(v) {

src/test/bench/core-uint-to-str.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use std::uint;
1414
fn main() {
1515
let args = os::args();
1616
let args = if os::getenv("RUST_BENCH").is_some() {
17-
~[~"", ~"10000000"]
17+
vec!(~"", ~"10000000")
1818
} else if args.len() <= 1u {
19-
~[~"", ~"100000"]
19+
vec!(~"", ~"100000")
2020
} else {
2121
args
2222
};

src/test/bench/msgsend-pipes-shared.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn run(args: &[~str]) {
5959
let workers = from_str::<uint>(args[2]).unwrap();
6060
let num_bytes = 100;
6161
let start = time::precise_time_s();
62-
let mut worker_results = ~[];
62+
let mut worker_results = Vec::new();
6363
for _ in range(0u, workers) {
6464
let to_child = to_child.clone();
6565
let mut builder = task::task();
@@ -96,9 +96,9 @@ fn run(args: &[~str]) {
9696
fn main() {
9797
let args = os::args();
9898
let args = if os::getenv("RUST_BENCH").is_some() {
99-
~[~"", ~"1000000", ~"10000"]
99+
vec!(~"", ~"1000000", ~"10000")
100100
} else if args.len() <= 1u {
101-
~[~"", ~"10000", ~"4"]
101+
vec!(~"", ~"10000", ~"4")
102102
} else {
103103
args.clone()
104104
};

src/test/bench/msgsend-pipes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn run(args: &[~str]) {
5353
let workers = from_str::<uint>(args[2]).unwrap();
5454
let num_bytes = 100;
5555
let start = time::precise_time_s();
56-
let mut worker_results = ~[];
56+
let mut worker_results = Vec::new();
5757
let from_parent = if workers == 1 {
5858
let (to_child, from_parent) = channel();
5959
let mut builder = task::task();
@@ -106,9 +106,9 @@ fn run(args: &[~str]) {
106106
fn main() {
107107
let args = os::args();
108108
let args = if os::getenv("RUST_BENCH").is_some() {
109-
~[~"", ~"1000000", ~"8"]
109+
vec!(~"", ~"1000000", ~"8")
110110
} else if args.len() <= 1u {
111-
~[~"", ~"10000", ~"4"]
111+
vec!(~"", ~"10000", ~"4")
112112
} else {
113113
args.clone()
114114
};

src/test/bench/msgsend-ring-mutex-arcs.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::os;
2525
use std::uint;
2626

2727
// A poor man's pipe.
28-
type pipe = MutexArc<~[uint]>;
28+
type pipe = MutexArc<Vec<uint> >;
2929

3030
fn send(p: &pipe, msg: uint) {
3131
unsafe {
@@ -47,7 +47,7 @@ fn recv(p: &pipe) -> uint {
4747
}
4848

4949
fn init() -> (pipe,pipe) {
50-
let m = MutexArc::new(~[]);
50+
let m = MutexArc::new(Vec::new());
5151
((&m).clone(), m)
5252
}
5353

@@ -71,9 +71,9 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
7171
fn main() {
7272
let args = os::args();
7373
let args = if os::getenv("RUST_BENCH").is_some() {
74-
~[~"", ~"100", ~"10000"]
74+
vec!(~"", ~"100", ~"10000")
7575
} else if args.len() <= 1u {
76-
~[~"", ~"10", ~"100"]
76+
vec!(~"", ~"10", ~"100")
7777
} else {
7878
args.clone()
7979
};
@@ -86,7 +86,7 @@ fn main() {
8686
let start = time::precise_time_s();
8787
8888
// create the ring
89-
let mut futures = ~[];
89+
let mut futures = Vec::new();
9090
9191
for i in range(1u, num_tasks) {
9292
//println!("spawning %?", i);

src/test/bench/msgsend-ring-rw-arcs.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use std::os;
2424
use std::uint;
2525

2626
// A poor man's pipe.
27-
type pipe = RWArc<~[uint]>;
27+
type pipe = RWArc<Vec<uint> >;
2828

2929
fn send(p: &pipe, msg: uint) {
3030
p.write_cond(|state, cond| {
@@ -42,7 +42,7 @@ fn recv(p: &pipe) -> uint {
4242
}
4343

4444
fn init() -> (pipe,pipe) {
45-
let x = RWArc::new(~[]);
45+
let x = RWArc::new(Vec::new());
4646
((&x).clone(), x)
4747
}
4848

@@ -66,9 +66,9 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
6666
fn main() {
6767
let args = os::args();
6868
let args = if os::getenv("RUST_BENCH").is_some() {
69-
~[~"", ~"100", ~"10000"]
69+
vec!(~"", ~"100", ~"10000")
7070
} else if args.len() <= 1u {
71-
~[~"", ~"10", ~"100"]
71+
vec!(~"", ~"10", ~"100")
7272
} else {
7373
args.clone()
7474
};
@@ -81,7 +81,7 @@ fn main() {
8181
let start = time::precise_time_s();
8282
8383
// create the ring
84-
let mut futures = ~[];
84+
let mut futures = Vec::new();
8585
8686
for i in range(1u, num_tasks) {
8787
//println!("spawning %?", i);

src/test/bench/shootout-ackermann.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ fn ack(m: int, n: int) -> int {
2525
fn main() {
2626
let args = os::args();
2727
let args = if os::getenv("RUST_BENCH").is_some() {
28-
~[~"", ~"12"]
28+
vec!(~"", ~"12")
2929
} else if args.len() <= 1u {
30-
~[~"", ~"8"]
30+
vec!(~"", ~"8")
3131
} else {
3232
args
3333
};

src/test/bench/shootout-chameneos-redux.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn show_color(cc: color) -> ~str {
3939
}
4040
}
4141

42-
fn show_color_list(set: ~[color]) -> ~str {
42+
fn show_color_list(set: vec!(color)) -> ~str {
4343
let mut out = ~"";
4444
for col in set.iter() {
4545
out.push_char(' ');
@@ -132,7 +132,7 @@ fn creature(
132132
}
133133
}
134134
135-
fn rendezvous(nn: uint, set: ~[color]) {
135+
fn rendezvous(nn: uint, set: vec!(color)) {
136136
137137
// these ports will allow us to hear from the creatures
138138
let (to_rendezvous, from_creatures) = channel::<CreatureInfo>();
@@ -141,7 +141,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
141141
// these channels will be passed to the creatures so they can talk to us
142142
143143
// these channels will allow us to talk to each creature by 'name'/index
144-
let to_creature: ~[Sender<Option<CreatureInfo>>] =
144+
let to_creature: Vec<Sender<Option<CreatureInfo>>> =
145145
set.iter().enumerate().map(|(ii, col)| {
146146
// create each creature as a listener with a port, and
147147
// give us a channel to talk to each
@@ -179,7 +179,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
179179
}
180180
181181
// save each creature's meeting stats
182-
let mut report = ~[];
182+
let mut report = Vec::new();
183183
for _to_one in to_creature.iter() {
184184
report.push(from_creatures_log.recv());
185185
}
@@ -199,9 +199,9 @@ fn rendezvous(nn: uint, set: ~[color]) {
199199
fn main() {
200200
let args = os::args();
201201
let args = if os::getenv("RUST_BENCH").is_some() {
202-
~[~"", ~"200000"]
202+
vec!(~"", ~"200000")
203203
} else if args.len() <= 1u {
204-
~[~"", ~"600"]
204+
vec!(~"", ~"600")
205205
} else {
206206
args
207207
};
@@ -211,9 +211,9 @@ fn main() {
211211
print_complements();
212212
println!("");
213213
214-
rendezvous(nn, ~[Blue, Red, Yellow]);
214+
rendezvous(nn, vec!(Blue, Red, Yellow));
215215
println!("");
216216

217217
rendezvous(nn,
218-
~[Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue]);
218+
vec!(Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue));
219219
}

src/test/bench/shootout-fasta-redux.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ static HOMO_SAPIENS: [AminoAcid, ..4] = [
5959
];
6060

6161
// FIXME: Use map().
62-
fn sum_and_scale(a: &'static [AminoAcid]) -> ~[AminoAcid] {
63-
let mut result = ~[];
62+
fn sum_and_scale(a: &'static [AminoAcid]) -> Vec<AminoAcid> {
63+
let mut result = Vec::new();
6464
let mut p = 0f32;
6565
for a_i in a.iter() {
6666
let mut a_i = *a_i;

src/test/bench/shootout-fasta.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ impl MyRandom {
3636

3737
struct AAGen<'a> {
3838
rng: &'a mut MyRandom,
39-
data: ~[(u32, u8)]
40-
}
39+
data: Vec<(u32, u8)> }
4140
impl<'a> AAGen<'a> {
4241
fn new<'b>(rng: &'b mut MyRandom, aa: &[(char, f32)]) -> AAGen<'b> {
4342
let mut cum = 0.;

src/test/bench/shootout-fibo.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ fn fib(n: int) -> int {
2121
fn main() {
2222
let args = os::args();
2323
let args = if os::getenv("RUST_BENCH").is_some() {
24-
~[~"", ~"40"]
24+
vec!(~"", ~"40")
2525
} else if args.len() <= 1u {
26-
~[~"", ~"30"]
26+
vec!(~"", ~"30")
2727
} else {
2828
args
2929
};

0 commit comments

Comments
 (0)