Replace unwrap() by matching

This commit is contained in:
Matthias Beyer 2016-05-14 19:15:51 +02:00
parent 1e1cbec98b
commit a481200c9a

View file

@ -474,16 +474,11 @@ impl Store {
HookPosition::PostDelete => self.post_delete_aspects.clone(), HookPosition::PostDelete => self.post_delete_aspects.clone(),
}; };
let guard = guard let mut guard = match guard.deref().lock().map_err(|_| SE::new(SEK::LockError, None)) {
.deref() Err(e) => return Err(SE::new(SEK::HookRegisterError, Some(Box::new(e)))),
.lock() Ok(g) => g,
.map_err(|_| SE::new(SEK::LockError, None)); };
if guard.is_err() {
return Err(SE::new(SEK::HookRegisterError,
Some(Box::new(guard.err().unwrap()))));
}
let mut guard = guard.unwrap();
for mut aspect in guard.deref_mut() { for mut aspect in guard.deref_mut() {
if aspect.name().clone() == aspect_name.clone() { if aspect.name().clone() == aspect_name.clone() {
self.get_config_for_hook(h.name()).map(|config| h.set_config(config)); self.get_config_for_hook(h.name()).map(|config| h.set_config(config));