Remove unecessary error chaining

This commit is contained in:
Matthias Beyer 2017-09-09 21:13:21 +02:00
parent 4420f7a518
commit 3d8f75300d

View file

@ -146,7 +146,7 @@ impl StoreEntry {
#[cfg(feature = "fs-lock")] #[cfg(feature = "fs-lock")]
{ {
try!(open_file(pb.clone()) 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)); .chain_err(|| SEK::IoError));
} }
@ -180,8 +180,8 @@ impl StoreEntry {
fn write_entry(&mut self, entry: &Entry) -> Result<()> { fn write_entry(&mut self, entry: &Entry) -> Result<()> {
if self.is_borrowed() { if self.is_borrowed() {
assert_eq!(self.id, entry.location); assert_eq!(self.id, entry.location);
self.file.write_file_content(entry) self.file
.chain_err(|| SEK::FileError) .write_file_content(entry)
.map(|_| ()) .map(|_| ())
} else { } else {
Ok(()) Ok(())
@ -194,9 +194,8 @@ impl Drop for StoreEntry {
fn drop(self) { fn drop(self) {
self.get_entry() self.get_entry()
.and_then(|entry| open_file(entry.get_location().clone()).chain_err(|| SEK::IoError)) .and_then(|entry| open_file(entry.get_location().clone()))
.and_then(|f| f.unlock().chain_err(|| SEK::FileError)) .and_then(|f| f.unlock())
.chain_err(|| SEK::IoError)
} }
} }