diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2014-12-26 01:17:30 +0100 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2014-12-26 01:17:30 +0100 |
| commit | 12e60719c4cd2f1f4f8790eb0452869c5816f7dd (patch) | |
| tree | 9fd2b89d997517ef1fe405150e6054ecbbad0990 | |
| parent | dd0baf7f01fc470fb7406b785d03e24fa116ed1c (diff) | |
| download | rust-12e60719c4cd2f1f4f8790eb0452869c5816f7dd.tar.gz rust-12e60719c4cd2f1f4f8790eb0452869c5816f7dd.zip | |
Fix up remaining usage of `to_ascii`.
| -rw-r--r-- | src/test/bench/shootout-k-nucleotide-pipes.rs | 9 | ||||
| -rw-r--r-- | src/test/bench/shootout-k-nucleotide.rs | 6 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 8c11c3673d5..71b8a08e526 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<Vec<u8> , 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<Vec<u8> , uint>, total: uint) -> String { // given a map, search for the frequency of a pattern fn find(mm: &HashMap<Vec<u8> , 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 6aa6b02857f..a0ef392ed3a 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: Buffer>(r: &mut R, key: &str) -> Vec<u8> { { 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() { |
