Replace unwrap() by matching
This commit is contained in:
parent
1f66f67791
commit
70b3d3906e
1 changed files with 4 additions and 6 deletions
|
@ -409,12 +409,10 @@ impl Store {
|
||||||
/// the one on disk
|
/// the one on disk
|
||||||
pub fn retrieve_copy<S: IntoStoreId>(&self, id: S) -> Result<Entry> {
|
pub fn retrieve_copy<S: IntoStoreId>(&self, id: S) -> Result<Entry> {
|
||||||
let id = self.storify_id(id.into_storeid());
|
let id = self.storify_id(id.into_storeid());
|
||||||
let entries_lock = self.entries.write();
|
let entries = match self.entries.write() {
|
||||||
if entries_lock.is_err() {
|
Err(_) => return Err(SE::new(SEK::LockPoisoned, None)),
|
||||||
return Err(SE::new(SEK::LockPoisoned, None))
|
Ok(e) => e,
|
||||||
}
|
};
|
||||||
|
|
||||||
let entries = entries_lock.unwrap();
|
|
||||||
|
|
||||||
// if the entry is currently modified by the user, we cannot drop it
|
// 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) {
|
if entries.get(&id).map(|e| e.is_borrowed()).unwrap_or(false) {
|
||||||
|
|
Loading…
Reference in a new issue