]> git.lizzy.rs Git - rust.git/blobdiff - src/test/bench/shootout-chameneos-redux.rs
test: Make manual changes to deal with the fallout from removal of
[rust.git] / src / test / bench / shootout-chameneos-redux.rs
index c4671b4203f36ab495997fd708f091a63d8d0d88..29513d87153f74dd8d317c968009b07ff36129fc 100644 (file)
@@ -13,6 +13,7 @@
 use std::option;
 use std::os;
 use std::task;
+use std::vec_ng::Vec;
 
 fn print_complements() {
     let all = [Blue, Red, Yellow];
@@ -39,7 +40,7 @@ fn show_color(cc: color) -> ~str {
     }
 }
 
-fn show_color_list(set: vec!(color)) -> ~str {
+fn show_color_list(set: Vec<color>) -> ~str {
     let mut out = ~"";
     for col in set.iter() {
         out.push_char(' ');
@@ -132,7 +133,7 @@ fn creature(
     }
 }
 
-fn rendezvous(nn: uint, set: vec!(color)) {
+fn rendezvous(nn: uint, set: Vec<color>) {
 
     // these ports will allow us to hear from the creatures
     let (to_rendezvous, from_creatures) = channel::<CreatureInfo>();
@@ -141,7 +142,7 @@ fn rendezvous(nn: uint, set: vec!(color)) {
     // these channels will be passed to the creatures so they can talk to us
 
     // these channels will allow us to talk to each creature by 'name'/index
-    let to_creature: Vec<Sender<Option<CreatureInfo>>> =
+    let mut to_creature: Vec<Sender<Option<CreatureInfo>>> =
         set.iter().enumerate().map(|(ii, col)| {
             // create each creature as a listener with a port, and
             // give us a channel to talk to each
@@ -164,13 +165,13 @@ fn rendezvous(nn: uint, set: vec!(color)) {
 
     // set up meetings...
     for _ in range(0, nn) {
-        let fst_creature: CreatureInfo = from_creatures.recv();
-        let snd_creature: CreatureInfo = from_creatures.recv();
+        let mut fst_creature: CreatureInfo = from_creatures.recv();
+        let mut snd_creature: CreatureInfo = from_creatures.recv();
 
         creatures_met += 2;
 
-        to_creature[fst_creature.name].send(Some(snd_creature));
-        to_creature[snd_creature.name].send(Some(fst_creature));
+        to_creature.get_mut(fst_creature.name).send(Some(snd_creature));
+        to_creature.get_mut(snd_creature.name).send(Some(fst_creature));
     }
 
     // tell each creature to stop
@@ -203,10 +204,10 @@ fn main() {
     } else if args.len() <= 1u {
         vec!(~"", ~"600")
     } else {
-        args
+        args.move_iter().collect()
     };
 
-    let nn = from_str::<uint>(args[1]).unwrap();
+    let nn = from_str::<uint>(*args.get(1)).unwrap();
 
     print_complements();
     println!("");