1- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+ // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22// file at the top-level directory of this distribution and at
33// http://rust-lang.org/COPYRIGHT.
44//
@@ -19,19 +19,15 @@ extern mod extra;
1919
2020use std:: int;
2121use std:: io;
22- use std:: option;
2322use std:: os;
2423use std:: rand:: Rng ;
2524use std:: rand;
2625use std:: result;
2726use std:: str;
2827use std:: uint;
29- use std:: vec;
3028
3129static LINE_LENGTH : uint = 60 u;
3230
33- //fn LINE_LENGTH() -> uint { return 60u; }
34-
3531struct MyRandom {
3632 last : u32
3733}
@@ -95,17 +91,15 @@ fn make_repeat_fasta(wr: @io::Writer, id: ~str, desc: ~str, s: ~str, n: int) {
9591 wr. write_line ( ~">" + id + " " + desc);
9692 let mut op = str::with_capacity( LINE_LENGTH );
9793 let sl = s.len();
98- unsafe {
99- for uint::range(0u, n as uint) |i| {
100- if (op.len() >= LINE_LENGTH) {
101- wr.write_line( op );
102- op = str::with_capacity( LINE_LENGTH );
103- }
104- op.push_char( s[i % sl] as char );
105- }
106- if op.len() > 0 {
107- wr.write_line(op)
94+ for uint::range(0u, n as uint) |i| {
95+ if (op.len() >= LINE_LENGTH) {
96+ wr.write_line( op );
97+ op = str::with_capacity( LINE_LENGTH );
10898 }
99+ op.push_char( s[i % sl] as char );
100+ }
101+ if op.len() > 0 {
102+ wr.write_line(op)
109103 }
110104}
111105
@@ -115,7 +109,7 @@ fn acid(ch: char, prob: u32) -> AminoAcids {
115109
116110fn main() {
117111 let args = os::args();
118- let args = if os::getenv(~ " RUST_BENCH ") . is_some ( ) {
112+ let args = if os::getenv(" RUST_BENCH ") . is_some ( ) {
119113 // alioth tests k-nucleotide with this data at 25,000,000
120114 ~[ ~"", ~"5000000 "]
121115 } else if args. len ( ) <= 1 u {
@@ -124,9 +118,9 @@ fn main() {
124118 args
125119 } ;
126120
127- let writer = if os:: getenv ( ~ "RUST_BENCH ") . is_some ( ) {
121+ let writer = if os:: getenv ( "RUST_BENCH" ) . is_some ( ) {
128122 result:: get ( & io:: file_writer ( & Path ( "./shootout-fasta.data" ) ,
129- ~ [ io:: Truncate , io:: Create ] ) )
123+ [ io:: Truncate , io:: Create ] ) )
130124 } else {
131125 io:: stdout ( )
132126 } ;
0 commit comments