Skip to content

Commit 12e6071

Browse files
committed
Fix up remaining usage of to_ascii.
1 parent dd0baf7 commit 12e6071

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/test/bench/shootout-k-nucleotide-pipes.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
extern crate collections;
1919

20+
use std::ascii::{AsciiExt, OwnedAsciiExt};
2021
use std::collections::HashMap;
2122
use std::mem::replace;
2223
use std::num::Float;
@@ -64,18 +65,16 @@ fn sort_and_fmt(mm: &HashMap<Vec<u8> , uint>, total: uint) -> String {
6465
let mut buffer = String::new();
6566
for &(ref k, v) in pairs_sorted.iter() {
6667
buffer.push_str(format!("{} {:0.3}\n",
67-
k.as_slice()
68-
.to_ascii()
69-
.to_uppercase()
70-
.into_string(), v).as_slice());
68+
k.to_ascii_uppercase(),
69+
v).as_slice());
7170
}
7271

7372
return buffer
7473
}
7574

7675
// given a map, search for the frequency of a pattern
7776
fn find(mm: &HashMap<Vec<u8> , uint>, key: String) -> uint {
78-
let key = key.into_ascii().as_slice().to_lowercase().into_string();
77+
let key = key.into_ascii_lowercase();
7978
match mm.get(key.as_bytes()) {
8079
option::Option::None => { return 0u; }
8180
option::Option::Some(&num) => { return num; }

src/test/bench/shootout-k-nucleotide.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
#![feature(slicing_syntax)]
4444

45+
use std::ascii::OwnedAsciiExt;
4546
use std::string::String;
4647
use std::slice;
4748
use std::sync::{Arc, Future};
@@ -286,10 +287,7 @@ fn get_sequence<R: Buffer>(r: &mut R, key: &str) -> Vec<u8> {
286287
{
287288
res.push_all(l.as_slice().trim().as_bytes());
288289
}
289-
for b in res.iter_mut() {
290-
*b = b.to_ascii().to_uppercase().to_byte();
291-
}
292-
res
290+
res.into_ascii_uppercase()
293291
}
294292

295293
fn main() {

0 commit comments

Comments
 (0)