vec: remove BaseIter implementation
I removed the `static-method-test.rs` test because it was heavily based on `BaseIter` and there are plenty of other more complex uses of static methods anyway.
This commit is contained in:
parent
c9342663df
commit
d2e9912aea
181 changed files with 796 additions and 876 deletions
|
|
@ -141,7 +141,7 @@ fn bfs(graph: graph, key: node_id) -> bfs_result {
|
|||
while !q.is_empty() {
|
||||
let t = q.pop_front();
|
||||
|
||||
do graph[t].each() |k| {
|
||||
do graph[t].iter().advance |k| {
|
||||
if marks[*k] == -1i64 {
|
||||
marks[*k] = t;
|
||||
q.add_back(*k);
|
||||
|
|
@ -201,7 +201,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result {
|
|||
|
||||
let mut color = white;
|
||||
|
||||
do neighbors.each() |k| {
|
||||
do neighbors.iter().advance |k| {
|
||||
if is_gray(&colors[*k]) {
|
||||
color = gray(*k);
|
||||
false
|
||||
|
|
@ -286,7 +286,7 @@ fn pbfs(graph: &arc::ARC<graph>, key: node_id) -> bfs_result {
|
|||
|
||||
let mut color = white;
|
||||
|
||||
do neighbors.each() |k| {
|
||||
do neighbors.iter().advance |k| {
|
||||
if is_gray(&colors[*k]) {
|
||||
color = gray(*k);
|
||||
false
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static HOMO_SAPIENS: [AminoAcid, ..4] = [
|
|||
fn sum_and_scale(a: &'static [AminoAcid]) -> ~[AminoAcid] {
|
||||
let mut result = ~[];
|
||||
let mut p = 0f32;
|
||||
for a.each |a_i| {
|
||||
for a.iter().advance |a_i| {
|
||||
let mut a_i = *a_i;
|
||||
p += a_i.p;
|
||||
a_i.p = p * LOOKUP_SCALE;
|
||||
|
|
@ -151,7 +151,7 @@ impl RandomFasta {
|
|||
|
||||
fn nextc(&mut self) -> u8 {
|
||||
let r = self.rng(1.0);
|
||||
for self.lookup.each |a| {
|
||||
for self.lookup.iter().advance |a| {
|
||||
if a.p >= r {
|
||||
return a.c;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ struct AminoAcids {
|
|||
fn make_cumulative(aa: ~[AminoAcids]) -> ~[AminoAcids] {
|
||||
let mut cp: u32 = 0u32;
|
||||
let mut ans: ~[AminoAcids] = ~[];
|
||||
for aa.each |a| {
|
||||
for aa.iter().advance |a| {
|
||||
cp += a.prob;
|
||||
ans += [AminoAcids {ch: a.ch, prob: cp}];
|
||||
}
|
||||
return ans;
|
||||
ans
|
||||
}
|
||||
|
||||
fn select_random(r: u32, genelist: ~[AminoAcids]) -> char {
|
||||
|
|
@ -64,7 +64,7 @@ fn select_random(r: u32, genelist: ~[AminoAcids]) -> char {
|
|||
} else { return bisect(v, mid, hi, target); }
|
||||
} else { return v[hi].ch; }
|
||||
}
|
||||
return bisect(copy genelist, 0, genelist.len() - 1, r);
|
||||
bisect(copy genelist, 0, genelist.len() - 1, r)
|
||||
}
|
||||
|
||||
fn make_random_fasta(wr: @io::Writer,
|
||||
|
|
@ -106,7 +106,7 @@ fn make_repeat_fasta(wr: @io::Writer, id: ~str, desc: ~str, s: ~str, n: int) {
|
|||
}
|
||||
|
||||
fn acid(ch: char, prob: u32) -> AminoAcids {
|
||||
return AminoAcids {ch: ch, prob: prob};
|
||||
AminoAcids {ch: ch, prob: prob}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ fn sort_and_fmt(mm: &HashMap<~[u8], uint>, total: uint) -> ~str {
|
|||
|
||||
let mut buffer = ~"";
|
||||
|
||||
for pairs_sorted.each |kv| {
|
||||
for pairs_sorted.iter().advance |kv| {
|
||||
let (k,v) = copy *kv;
|
||||
unsafe {
|
||||
let b = str::raw::from_bytes(k);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ fn stress(num_tasks: int) {
|
|||
stress_task(i);
|
||||
}
|
||||
}
|
||||
for results.each |r| {
|
||||
for results.iter().advance |r| {
|
||||
r.recv();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue