Remove unwrap() by matching
This commit is contained in:
parent
ac8bcde239
commit
3fb6d507e5
1 changed files with 5 additions and 5 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue