Use try!() instead of unwrap()

This commit is contained in:
Daniel Grunwald 2015-05-17 21:42:34 +02:00
parent db8edd7f4e
commit 6a0f951e94

View file

@ -174,7 +174,7 @@ impl <'p, 's> FromPyObject<'p, 's> for Cow<'s, str> {
}
} else if let Ok(u) = o.cast_as::<PyUnicode>() {
let u = u.as_slice();
let s = unicode_buf_to_str(py, u).unwrap();
let s = try!(unicode_buf_to_str(py, u));
Ok(Cow::Owned(s))
} else {
Err(PyErr::new_lazy_init(py.get_type::<exc::TypeError>(), None))