From 27009be687637e808d3bc39bbdb064e3342181e6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 4 Aug 2016 14:04:59 +0200 Subject: [PATCH] Replace unwrap() with try!() --- libimagentrytag/src/tagable.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libimagentrytag/src/tagable.rs b/libimagentrytag/src/tagable.rs index f4859863..6dc6d6c6 100644 --- a/libimagentrytag/src/tagable.rs +++ b/libimagentrytag/src/tagable.rs @@ -30,12 +30,7 @@ pub trait Tagable { impl Tagable for EntryHeader { fn get_tags(&self) -> Result> { - let tags = self.read("imag.tags"); - if tags.is_err() { - let kind = TagErrorKind::HeaderReadError; - return Err(kind.into_error_with_cause(Box::new(tags.unwrap_err()))); - } - let tags = tags.unwrap(); + let tags = try!(self.read("imag.tags").map_err_into(TagErrorKind::HeaderReadError)); match tags { Some(Value::Array(tags)) => {