summaryrefslogtreecommitdiffstats
path: root/libimagstore
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-05-14 19:14:11 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-05-15 14:01:55 +0200
commit70b3d3906ec1dd624a59343e9325efc48b33728c (patch)
tree3dfc8358b529cbf74d4f04a9093cb95538c6e44c /libimagstore
parent1f66f67791762e3d2bde0f823b3db94f69c0b8cf (diff)
Replace unwrap() by matching
Diffstat (limited to 'libimagstore')
-rw-r--r--libimagstore/src/store.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs
index 4b30a025..ec6353c4 100644
--- a/libimagstore/src/store.rs
+++ b/libimagstore/src/store.rs
@@ -409,12 +409,10 @@ impl Store {
/// the one on disk
pub fn retrieve_copy<S: IntoStoreId>(&self, id: S) -> Result<Entry> {
let id = self.storify_id(id.into_storeid());
- let entries_lock = self.entries.write();
- if entries_lock.is_err() {
- return Err(SE::new(SEK::LockPoisoned, None))
- }
-
- let entries = entries_lock.unwrap();
+ let entries = match self.entries.write() {
+ Err(_) => return Err(SE::new(SEK::LockPoisoned, None)),
+ Ok(e) => e,
+ };
// if the entry is currently modified by the user, we cannot drop it
if entries.get(&id).map(|e| e.is_borrowed()).unwrap_or(false) {