Remove some internal ~[] from several libraries.

Some straggling instances of `~[]` across a few different libs. Also,
remove some public ones from workcache.
This commit is contained in:
Huon Wilson 2014-04-09 20:02:26 +10:00 committed by Alex Crichton
parent 32cf4a188c
commit 6e63b12f5f
12 changed files with 34 additions and 31 deletions

View File

@ -451,7 +451,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
let options_to_remove = [~"-O", ~"-g", ~"--debuginfo"];
let new_options = split_maybe_args(options).move_iter()
.filter(|x| !options_to_remove.contains(x))
.collect::<~[~str]>()
.collect::<Vec<~str>>()
.connect(" ");
Some(new_options)
}

View File

@ -117,13 +117,13 @@ mod tests {
words.push(r.gen_vec::<u8>(range));
}
for _ in range(0, 20) {
let mut input = ~[];
let mut input = vec![];
for _ in range(0, 2000) {
input.push_all(r.choose(words.as_slice()).as_slice());
}
debug!("de/inflate of {} bytes of random word-sequences",
input.len());
let cmp = deflate_bytes(input).expect("deflation failed");
let cmp = deflate_bytes(input.as_slice()).expect("deflation failed");
let out = inflate_bytes(cmp.as_slice()).expect("inflation failed");
debug!("{} bytes deflated to {} ({:.1f}% size)",
input.len(), cmp.len(),

View File

@ -53,7 +53,7 @@
//!
//! let program = args[0].clone();
//!
//! let opts = ~[
//! let opts = [
//! optopt("o", "", "set output file name", "NAME"),
//! optflag("h", "help", "print this help menu")
//! ];

View File

@ -31,6 +31,8 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://static.rust-lang.org/doc/master")]
#![deny(deprecated_owned_vector)]
use std::cell::Cell;
use std::{cmp, os, path};
use std::io::fs;
@ -245,26 +247,26 @@ impl Pattern {
*/
pub fn new(pattern: &str) -> Pattern {
let chars = pattern.chars().collect::<~[_]>();
let chars = pattern.chars().collect::<Vec<_>>();
let mut tokens = Vec::new();
let mut i = 0;
while i < chars.len() {
match chars[i] {
match *chars.get(i) {
'?' => {
tokens.push(AnyChar);
i += 1;
}
'*' => {
// *, **, ***, ****, ... are all equivalent
while i < chars.len() && chars[i] == '*' {
while i < chars.len() && *chars.get(i) == '*' {
i += 1;
}
tokens.push(AnySequence);
}
'[' => {
if i <= chars.len() - 4 && chars[i + 1] == '!' {
if i <= chars.len() - 4 && *chars.get(i + 1) == '!' {
match chars.slice_from(i + 3).position_elem(&']') {
None => (),
Some(j) => {
@ -276,7 +278,7 @@ impl Pattern {
}
}
}
else if i <= chars.len() - 3 && chars[i + 1] != '!' {
else if i <= chars.len() - 3 && *chars.get(i + 1) != '!' {
match chars.slice_from(i + 2).position_elem(&']') {
None => (),
Some(j) => {

View File

@ -190,7 +190,7 @@ fn visit_item(e: &Env, i: &ast::Item) {
} else {
None
})
.collect::<~[&ast::Attribute]>();
.collect::<Vec<&ast::Attribute>>();
for m in link_args.iter() {
match m.value_str() {
Some(linkarg) => e.sess.cstore.add_used_link_args(linkarg.get()),
@ -205,7 +205,7 @@ fn visit_item(e: &Env, i: &ast::Item) {
} else {
None
})
.collect::<~[&ast::Attribute]>();
.collect::<Vec<&ast::Attribute>>();
for m in link_args.iter() {
match m.meta_item_list() {
Some(items) => {

View File

@ -133,7 +133,7 @@ pub fn render(w: &mut io::Writer, s: &str, print_toc: bool) -> fmt::Result {
slice::raw::buf_as_slice((*text).data, (*text).size as uint, |text| {
let text = str::from_utf8(text).unwrap();
let mut lines = text.lines().filter(|l| stripped_filtered_line(*l).is_none());
let text = lines.collect::<~[&str]>().connect("\n");
let text = lines.collect::<Vec<&str>>().connect("\n");
let buf = buf {
data: text.as_bytes().as_ptr(),
@ -186,7 +186,7 @@ pub fn render(w: &mut io::Writer, s: &str, print_toc: bool) -> fmt::Result {
Some(s) => s.to_lower().into_str(),
None => s.to_owned()
}
}).collect::<~[~str]>().connect("-");
}).collect::<Vec<~str>>().connect("-");
let opaque = unsafe {&mut *(opaque as *mut my_opaque)};
@ -285,7 +285,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
let tests = &mut *(opaque as *mut ::test::Collector);
let text = str::from_utf8(text).unwrap();
let mut lines = text.lines().map(|l| stripped_filtered_line(l).unwrap_or(l));
let text = lines.collect::<~[&str]>().connect("\n");
let text = lines.collect::<Vec<&str>>().connect("\n");
tests.add_test(text, should_fail, no_run, ignore);
})
}

View File

@ -1205,8 +1205,8 @@ fn item_trait(w: &mut Writer, it: &clean::Item,
it.name.get_ref().as_slice(),
t.generics,
parents));
let required = t.methods.iter().filter(|m| m.is_req()).collect::<~[&clean::TraitMethod]>();
let provided = t.methods.iter().filter(|m| !m.is_req()).collect::<~[&clean::TraitMethod]>();
let required = t.methods.iter().filter(|m| m.is_req()).collect::<Vec<&clean::TraitMethod>>();
let provided = t.methods.iter().filter(|m| !m.is_req()).collect::<Vec<&clean::TraitMethod>>();
if t.methods.len() == 0 {
try!(write!(w, "\\{ \\}"));
@ -1502,11 +1502,11 @@ fn render_methods(w: &mut Writer, it: &clean::Item) -> fmt::Result {
let mut non_trait = v.iter().filter(|p| {
p.ref0().trait_.is_none()
});
let non_trait = non_trait.collect::<~[&(clean::Impl, Option<~str>)]>();
let non_trait = non_trait.collect::<Vec<&(clean::Impl, Option<~str>)>>();
let mut traits = v.iter().filter(|p| {
p.ref0().trait_.is_some()
});
let traits = traits.collect::<~[&(clean::Impl, Option<~str>)]>();
let traits = traits.collect::<Vec<&(clean::Impl, Option<~str>)>>();
if non_trait.len() > 0 {
try!(write!(w, "<h2 id='methods'>Methods</h2>"));

View File

@ -161,12 +161,12 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches) -> int
}
/// Run any tests/code examples in the markdown file `input`.
pub fn test(input: &str, libs: HashSet<Path>, mut test_args: ~[~str]) -> int {
pub fn test(input: &str, libs: HashSet<Path>, mut test_args: Vec<~str>) -> int {
let input_str = load_or_return!(input, 1, 2);
let mut collector = Collector::new(input.to_owned(), libs, true, true);
find_testable_code(input_str, &mut collector);
test_args.unshift(~"rustdoctest");
testing::test_main(test_args, collector.tests);
testing::test_main(test_args.as_slice(), collector.tests);
0
}

View File

@ -31,7 +31,7 @@ pub struct Guard<'a> {
}
struct Inner {
queue: ~[BlockedTask],
queue: Vec<BlockedTask>,
held: bool,
}
@ -39,7 +39,7 @@ impl Access {
pub fn new() -> Access {
Access {
inner: UnsafeArc::new(Inner {
queue: ~[],
queue: vec![],
held: false,
})
}

View File

@ -170,14 +170,14 @@ impl<'a> Stats for &'a [f64] {
// FIXME #11059 handle NaN, inf and overflow
#[allow(deprecated_owned_vector)]
fn sum(self) -> f64 {
let mut partials : ~[f64] = ~[];
let mut partials = vec![];
for &mut x in self.iter() {
let mut j = 0;
// This inner loop applies `hi`/`lo` summation to each
// partial so that the list of partial sums remains exact.
for i in range(0, partials.len()) {
let mut y = partials[i];
let mut y = *partials.get(i);
if num::abs(x) < num::abs(y) {
mem::swap(&mut x, &mut y);
}
@ -186,7 +186,7 @@ impl<'a> Stats for &'a [f64] {
let hi = x + y;
let lo = y - (hi - x);
if lo != 0f64 {
partials[j] = lo;
*partials.get_mut(j) = lo;
j += 1;
}
x = hi;
@ -194,7 +194,7 @@ impl<'a> Stats for &'a [f64] {
if j >= partials.len() {
partials.push(x);
} else {
partials[j] = x;
*partials.get_mut(j) = x;
partials.truncate(j+1);
}
}

View File

@ -17,6 +17,7 @@
html_root_url = "http://static.rust-lang.org/doc/master")]
#![feature(phase)]
#![allow(visible_private_types)]
#![deny(deprecated_owned_vector)]
#[phase(syntax, link)] extern crate log;
extern crate serialize;
@ -319,8 +320,8 @@ impl Exec {
}
// returns pairs of (kind, name)
pub fn lookup_discovered_inputs(&self) -> ~[(~str, ~str)] {
let mut rs = ~[];
pub fn lookup_discovered_inputs(&self) -> Vec<(~str, ~str)> {
let mut rs = vec![];
let WorkMap(ref discovered_inputs) = self.discovered_inputs;
for (k, v) in discovered_inputs.iter() {
let KindMap(ref vmap) = *v;
@ -341,8 +342,8 @@ impl<'a> Prep<'a> {
}
}
pub fn lookup_declared_inputs(&self) -> ~[~str] {
let mut rs = ~[];
pub fn lookup_declared_inputs(&self) -> Vec<~str> {
let mut rs = vec![];
let WorkMap(ref declared_inputs) = self.declared_inputs;
for (_, v) in declared_inputs.iter() {
let KindMap(ref vmap) = *v;

View File

@ -76,7 +76,7 @@ fn main() {
format!("{}\t trees of depth {}\t check: {}",
iterations * 2, depth, chk)
})
}).collect::<~[Future<~str>]>();
}).collect::<Vec<Future<~str>>>();
for message in messages.mut_iter() {
println!("{}", *message.get_ref());