Replace unwrap() with try!()

This commit is contained in:
Matthias Beyer 2016-08-04 14:05:38 +02:00
parent 27009be687
commit a07047b61a

View file

@ -101,12 +101,7 @@ impl Tagable for EntryHeader {
} }
fn has_tag(&self, t: TagSlice) -> Result<bool> { fn has_tag(&self, t: TagSlice) -> Result<bool> {
let tags = self.read("imag.tags"); let tags = try!(self.read("imag.tags").map_err_into(TagErrorKind::HeaderReadError));
if tags.is_err() {
let kind = TagErrorKind::HeaderReadError;
return Err(kind.into_error_with_cause(Box::new(tags.unwrap_err())));
}
let tags = tags.unwrap();
if !tags.iter().all(|t| is_match!(*t, Value::String(_))) { if !tags.iter().all(|t| is_match!(*t, Value::String(_))) {
return Err(TagErrorKind::TagTypeError.into()); return Err(TagErrorKind::TagTypeError.into());