Skip to content

Commit

Permalink
rustup
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntSushi committed Mar 11, 2015
1 parent a1a819a commit 71f4ee2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
#![deny(missing_docs)]

// These MUST be removed for Rust 1.0 stable.
#![feature(collections, core, std_misc, unicode, io)]
#![feature(collections, core, std_misc, io)]

extern crate libc;
extern crate regex;
Expand Down Expand Up @@ -988,18 +988,13 @@ impl rustc_serialize::Decoder for Decoder {
fn read_enum_variant<T, F>(&mut self, names: &[&str], mut f: F)
-> Result<T, Error>
where F: FnMut(&mut Decoder, usize) -> Result<T, Error> {
fn to_lower(s: &str) -> String {
s.chars().map(|c| c.to_lowercase()).collect()
}

let v = try!(self.pop_val());
let vstr = to_lower(v.as_str());
let v = try!(self.pop_val()).as_str().to_lowercase();
let i =
match names.iter().map(|&n| to_lower(n)).position(|n| n == vstr) {
match names.iter().map(|n| n.to_lowercase()).position(|n| n == v) {
Some(i) => i,
None => {
derr!("Could not match '{}' with any of \
the allowed variants: {:?}", vstr, names)
the allowed variants: {:?}", v, names)
}
};
f(self, i)
Expand Down
2 changes: 1 addition & 1 deletion src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ macro_rules! test_expect(
macro_rules! test_user_error(
($name:ident, $doc:expr, $args:expr) => (
#[test]
#[should_fail]
#[should_panic]
fn $name() { get_args($doc, $args); }
);
);
Expand Down

0 comments on commit 71f4ee2

Please sign in to comment.