diff --git a/src/lib.rs b/src/lib.rs index dd9e9f6..1df4570 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -500,12 +500,12 @@ impl Locale { pub fn new(s: &str) -> Result { let mut i = s.split(','); let mut res = Locale::from( - try!(LanguageRange::new( - i.next().unwrap()))); // NOTE: split "" is (""), not () + LanguageRange::new( + i.next().unwrap())?); // NOTE: split "" is (""), not () for t in i { if let Some(caps) = LOCALE_ELEMENT_REGEX.captures(t) { - let tag = try!(LanguageRange::new( - try!(caps.name("tag").map(|m| m.as_str()).ok_or(Error::NotWellFormed)))); + let tag = LanguageRange::new( + caps.name("tag").map(|m| m.as_str()).ok_or(Error::NotWellFormed)?)?; match caps.name("category").map(|m| m.as_str()) { Some(cat) => res.add_category(cat.to_ascii_lowercase().as_ref(), &tag), None => res.add(&tag),