Skip to content

Commit

Permalink
Fix up remaining usage of to_ascii.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Dec 26, 2014
1 parent dd0baf7 commit 12e6071
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/test/bench/shootout-k-nucleotide-pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

extern crate collections;

use std::ascii::{AsciiExt, OwnedAsciiExt};
use std::collections::HashMap;
use std::mem::replace;
use std::num::Float;
Expand Down Expand Up @@ -64,18 +65,16 @@ 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
}

// 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; }
Expand Down
6 changes: 2 additions & 4 deletions src/test/bench/shootout-k-nucleotide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

#![feature(slicing_syntax)]

use std::ascii::OwnedAsciiExt;
use std::string::String;
use std::slice;
use std::sync::{Arc, Future};
Expand Down Expand Up @@ -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() {
Expand Down

12 comments on commit 12e6071

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from sfackler
at SimonSapin@12e6071

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging SimonSapin/rust/ascii-reform = 12e6071 into auto

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "9b4fbc47e286cb6a34dee7dcb794f16739f8e770"}

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SimonSapin/rust/ascii-reform = 12e6071 merged ok, testing candidate = 9b4fbc4

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from sfackler
at SimonSapin@12e6071

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging SimonSapin/rust/ascii-reform = 12e6071 into auto

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "070ab63807dc80fa6a6c5ee80531284761ab42de"}

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SimonSapin/rust/ascii-reform = 12e6071 merged ok, testing candidate = 070ab63

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 070ab63

@bors
Copy link
Contributor

@bors bors commented on 12e6071 Dec 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 070ab63

Please sign in to comment.