From 3d8f75300df3b3675e6620ac0b4d3597f8d82f70 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 9 Sep 2017 21:13:21 +0200 Subject: [PATCH] Remove unecessary error chaining --- lib/core/libimagstore/src/store.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs index 4fec02c1..dbb00182 100644 --- a/lib/core/libimagstore/src/store.rs +++ b/lib/core/libimagstore/src/store.rs @@ -146,7 +146,7 @@ impl StoreEntry { #[cfg(feature = "fs-lock")] { try!(open_file(pb.clone()) - .and_then(|f| f.lock_exclusive().chain_err(|| SEK::FileError)) + .and_then(|f| f.lock_exclusive()) .chain_err(|| SEK::IoError)); } @@ -180,8 +180,8 @@ impl StoreEntry { fn write_entry(&mut self, entry: &Entry) -> Result<()> { if self.is_borrowed() { assert_eq!(self.id, entry.location); - self.file.write_file_content(entry) - .chain_err(|| SEK::FileError) + self.file + .write_file_content(entry) .map(|_| ()) } else { Ok(()) @@ -194,9 +194,8 @@ impl Drop for StoreEntry { fn drop(self) { self.get_entry() - .and_then(|entry| open_file(entry.get_location().clone()).chain_err(|| SEK::IoError)) - .and_then(|f| f.unlock().chain_err(|| SEK::FileError)) - .chain_err(|| SEK::IoError) + .and_then(|entry| open_file(entry.get_location().clone())) + .and_then(|f| f.unlock()) } }