Updated shootout-fasta.rs copyright years, removed stuff that caused lint to complain.

This commit is contained in:
Matthijs Hofstra 2013-06-16 23:48:46 +02:00
parent 66fd3c9e5d
commit 6762754d5b

View File

@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -19,19 +19,15 @@
use std::int;
use std::io;
use std::option;
use std::os;
use std::rand::Rng;
use std::rand;
use std::result;
use std::str;
use std::uint;
use std::vec;
static LINE_LENGTH: uint = 60u;
//fn LINE_LENGTH() -> uint { return 60u; }
struct MyRandom {
last: u32
}
@ -95,17 +91,15 @@ fn make_repeat_fasta(wr: @io::Writer, id: ~str, desc: ~str, s: ~str, n: int) {
wr.write_line(~">" + id + " " + desc);
let mut op = str::with_capacity( LINE_LENGTH );
let sl = s.len();
unsafe {
for uint::range(0u, n as uint) |i| {
if (op.len() >= LINE_LENGTH) {
wr.write_line( op );
op = str::with_capacity( LINE_LENGTH );
}
op.push_char( s[i % sl] as char );
}
if op.len() > 0 {
wr.write_line(op)
for uint::range(0u, n as uint) |i| {
if (op.len() >= LINE_LENGTH) {
wr.write_line( op );
op = str::with_capacity( LINE_LENGTH );
}
op.push_char( s[i % sl] as char );
}
if op.len() > 0 {
wr.write_line(op)
}
}
@ -115,7 +109,7 @@ fn acid(ch: char, prob: u32) -> AminoAcids {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
// alioth tests k-nucleotide with this data at 25,000,000
~[~"", ~"5000000"]
} else if args.len() <= 1u {
@ -124,9 +118,9 @@ fn main() {
args
};
let writer = if os::getenv(~"RUST_BENCH").is_some() {
let writer = if os::getenv("RUST_BENCH").is_some() {
result::get(&io::file_writer(&Path("./shootout-fasta.data"),
~[io::Truncate, io::Create]))
[io::Truncate, io::Create]))
} else {
io::stdout()
};