Remove unwrap() by matching

This commit is contained in:
Matthias Beyer 2016-05-14 19:05:11 +02:00
parent ac8bcde239
commit 3fb6d507e5

View file

@ -302,11 +302,11 @@ impl Store {
return Err(e);
}
let hsmap = self.entries.write();
if hsmap.is_err() {
return Err(StoreError::new(StoreErrorKind::LockPoisoned, None))
}
let mut hsmap = hsmap.unwrap();
let mut hsmap = match self.entries.write() {
Err(_) => return Err(StoreError::new(StoreErrorKind::LockPoisoned, None)),
Ok(s) => s,
};
if hsmap.contains_key(&id) {
return Err(StoreError::new(StoreErrorKind::EntryAlreadyExists, None))
}