diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 8c11c3673d52..71b8a08e5266 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -17,6 +17,7 @@ extern crate collections; +use std::ascii::{AsciiExt, OwnedAsciiExt}; use std::collections::HashMap; use std::mem::replace; use std::num::Float; @@ -64,10 +65,8 @@ fn sort_and_fmt(mm: &HashMap , uint>, total: uint) -> String { let mut buffer = String::new(); for &(ref k, v) in pairs_sorted.iter() { buffer.push_str(format!("{} {:0.3}\n", - k.as_slice() - .to_ascii() - .to_uppercase() - .into_string(), v).as_slice()); + k.to_ascii_uppercase(), + v).as_slice()); } return buffer @@ -75,7 +74,7 @@ fn sort_and_fmt(mm: &HashMap , uint>, total: uint) -> String { // given a map, search for the frequency of a pattern fn find(mm: &HashMap , uint>, key: String) -> uint { - let key = key.into_ascii().as_slice().to_lowercase().into_string(); + let key = key.into_ascii_lowercase(); match mm.get(key.as_bytes()) { option::Option::None => { return 0u; } option::Option::Some(&num) => { return num; } diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 6aa6b02857fb..a0ef392ed3af 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -42,6 +42,7 @@ #![feature(slicing_syntax)] +use std::ascii::OwnedAsciiExt; use std::string::String; use std::slice; use std::sync::{Arc, Future}; @@ -286,10 +287,7 @@ fn get_sequence(r: &mut R, key: &str) -> Vec { { res.push_all(l.as_slice().trim().as_bytes()); } - for b in res.iter_mut() { - *b = b.to_ascii().to_uppercase().to_byte(); - } - res + res.into_ascii_uppercase() } fn main() {