Remove some singleton vector appends.
This commit is contained in:
parent
4d1e415611
commit
51ba3518ec
9 changed files with 16 additions and 16 deletions
|
@ -316,7 +316,7 @@ fn load_crate(filename: str) -> option<crate> {
|
||||||
|
|
||||||
alt *attr_name {
|
alt *attr_name {
|
||||||
"std" | "core" { }
|
"std" | "core" { }
|
||||||
_ { e.deps += [query]; }
|
_ { vec::push(e.deps, query); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ { }
|
_ { }
|
||||||
|
@ -775,7 +775,7 @@ fn install_source(c: cargo, path: str) {
|
||||||
let mut cratefiles = [];
|
let mut cratefiles = [];
|
||||||
for os::walk_dir(".") {|p|
|
for os::walk_dir(".") {|p|
|
||||||
if str::ends_with(p, ".rc") {
|
if str::ends_with(p, ".rc") {
|
||||||
cratefiles += [p];
|
vec::push(cratefiles, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ fn make_tests(config: config) -> [test::test_desc] {
|
||||||
let file = file;
|
let file = file;
|
||||||
#debug("inspecting file %s", file);
|
#debug("inspecting file %s", file);
|
||||||
if is_test(config, file) {
|
if is_test(config, file) {
|
||||||
tests += [make_test(config, file)]
|
vec::push(tests, make_test(config, file))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret tests;
|
ret tests;
|
||||||
|
|
|
@ -31,7 +31,7 @@ fn load_props(testfile: str) -> test_props {
|
||||||
let mut pp_exact = option::none;
|
let mut pp_exact = option::none;
|
||||||
for iter_header(testfile) {|ln|
|
for iter_header(testfile) {|ln|
|
||||||
alt parse_error_pattern(ln) {
|
alt parse_error_pattern(ln) {
|
||||||
option::some(ep) { error_patterns += [ep]; }
|
option::some(ep) { vec::push(error_patterns, ep) }
|
||||||
option::none { }
|
option::none { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,11 +44,11 @@ fn load_props(testfile: str) -> test_props {
|
||||||
}
|
}
|
||||||
|
|
||||||
option::iter(parse_aux_build(ln)) {|ab|
|
option::iter(parse_aux_build(ln)) {|ab|
|
||||||
aux_builds += [ab];
|
vec::push(aux_builds, ab);
|
||||||
}
|
}
|
||||||
|
|
||||||
option::iter(parse_exec_env(ln)) {|ee|
|
option::iter(parse_exec_env(ln)) {|ee|
|
||||||
exec_env += [ee];
|
vec::push(exec_env, ee);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ret {
|
ret {
|
||||||
|
|
|
@ -19,7 +19,7 @@ fn target_env(lib_path: str, prog: str) -> [(str,str)] {
|
||||||
else { (k,v) }
|
else { (k,v) }
|
||||||
};
|
};
|
||||||
if str::ends_with(prog, "rustc.exe") {
|
if str::ends_with(prog, "rustc.exe") {
|
||||||
env += [("RUST_THREADS", "1")]
|
vec::push(env, ("RUST_THREADS", "1"));
|
||||||
}
|
}
|
||||||
ret env;
|
ret env;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: str) {
|
||||||
procres);
|
procres);
|
||||||
}
|
}
|
||||||
|
|
||||||
srcs += [procres.stdout];
|
vec::push(srcs, procres.stdout);
|
||||||
round += 1;
|
round += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ fn test_cycles(r : rand::rng, k: uint, n: uint)
|
||||||
|
|
||||||
// Create a graph with no edges
|
// Create a graph with no edges
|
||||||
range(0u, vlen) {|_i|
|
range(0u, vlen) {|_i|
|
||||||
v += [mut empty_pointy()];
|
vec::push(v, empty_pointy());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in the graph with random edges, with density k/n
|
// Fill in the graph with random edges, with density k/n
|
||||||
|
@ -77,7 +77,7 @@ fn test_cycles(r : rand::rng, k: uint, n: uint)
|
||||||
// https://github.com/mozilla/rust/issues/1899
|
// https://github.com/mozilla/rust/issues/1899
|
||||||
|
|
||||||
if (likelihood(r, k, n)) { v[i].m = [p(choice(r, v))]; }
|
if (likelihood(r, k, n)) { v[i].m = [p(choice(r, v))]; }
|
||||||
if (likelihood(r, k, n)) { v[i].n += [mut p(choice(r, v))]; }
|
if (likelihood(r, k, n)) { vec::push(v[i].n, mut p(choice(r, v))); }
|
||||||
if (likelihood(r, k, n)) { v[i].o = {x: 0, y: p(choice(r, v))}; }
|
if (likelihood(r, k, n)) { v[i].o = {x: 0, y: p(choice(r, v))}; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ fn stash_ty_if(c: fn@(@ast::ty, test_mode)->bool,
|
||||||
e: @ast::ty,
|
e: @ast::ty,
|
||||||
tm: test_mode) {
|
tm: test_mode) {
|
||||||
if c(e, tm) {
|
if c(e, tm) {
|
||||||
*es += [*e];
|
vec::push(*es,*e);
|
||||||
} else {/* now my indices are wrong :( */ }
|
} else {/* now my indices are wrong :( */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,11 +57,11 @@ fn vec_edits<T: copy>(v: [T], xs: [T]) -> [[T]] {
|
||||||
|
|
||||||
if Lv != 1u {
|
if Lv != 1u {
|
||||||
// When Lv == 1u, this is redundant with omit.
|
// When Lv == 1u, this is redundant with omit.
|
||||||
edits += [[]];
|
vec::push(edits, []);
|
||||||
}
|
}
|
||||||
if Lv >= 3u {
|
if Lv >= 3u {
|
||||||
// When Lv == 2u, this is redundant with swap.
|
// When Lv == 2u, this is redundant with swap.
|
||||||
edits += [vec::reversed(v)];
|
vec::push(edits, vec::reversed(v));
|
||||||
}
|
}
|
||||||
ix(0u, 1u, Lv) {|i| edits += [vec_omit(v, i)]; }
|
ix(0u, 1u, Lv) {|i| edits += [vec_omit(v, i)]; }
|
||||||
ix(0u, 1u, Lv) {|i| edits += [vec_dup(v, i)]; }
|
ix(0u, 1u, Lv) {|i| edits += [vec_dup(v, i)]; }
|
||||||
|
@ -71,10 +71,10 @@ fn vec_edits<T: copy>(v: [T], xs: [T]) -> [[T]] {
|
||||||
|
|
||||||
ix(0u, 1u, len(xs)) {|j|
|
ix(0u, 1u, len(xs)) {|j|
|
||||||
ix(0u, 1u, Lv) {|i|
|
ix(0u, 1u, Lv) {|i|
|
||||||
edits += [vec_poke(v, i, xs[j])];
|
vec::push(edits, vec_poke(v, i, xs[j]));
|
||||||
}
|
}
|
||||||
ix(0u, 0u, Lv) {|i|
|
ix(0u, 0u, Lv) {|i|
|
||||||
edits += [vec_insert(v, i, xs[j])];
|
vec::push(edits, vec_insert(v, i, xs[j]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ fn weighted_vec<T: copy>(v : [weighted<T>]) -> [T] {
|
||||||
for {weight: weight, item: item} in v {
|
for {weight: weight, item: item} in v {
|
||||||
let i = 0u;
|
let i = 0u;
|
||||||
while i < weight {
|
while i < weight {
|
||||||
r += [item];
|
vec::push(r, item);
|
||||||
i += 1u;
|
i += 1u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue