Refactor for less verbose code

This commit is contained in:
Matthias Beyer 2018-03-22 13:59:01 +01:00
parent 2232f0153f
commit 247b9499a7

View file

@ -258,6 +258,7 @@ pub mod builder {
use libimagstore::storeid::IntoStoreId; use libimagstore::storeid::IntoStoreId;
use libimagstore::store::FileLockEntry; use libimagstore::store::FileLockEntry;
use libimagentryutil::isa::Is; use libimagentryutil::isa::Is;
use libimagutil::debug_result::DebugResult;
use error::HabitError as HE; use error::HabitError as HE;
use error::HabitErrorKind as HEK; use error::HabitErrorKind as HEK;
@ -307,14 +308,17 @@ pub mod builder {
HE::from_kind(HEK::HabitBuilderMissing(s)) HE::from_kind(HEK::HabitBuilderMissing(s))
} }
let name = try!(self.name.ok_or_else(|| mkerr("name"))); let name = self.name
debug!("Success: Name present"); .ok_or_else(|| mkerr("name"))
.map_dbg_str("Success: Name present")?;
let dateobj = try!(self.basedate.ok_or_else(|| mkerr("date"))); let dateobj = self.basedate
debug!("Success: Date present"); .ok_or_else(|| mkerr("date"))
.map_dbg_str("Success: Date present")?;
let recur = try!(self.recurspec.ok_or_else(|| mkerr("recurspec"))); let recur = self.recurspec
debug!("Success: Recurr spec present"); .ok_or_else(|| mkerr("recurspec"))
.map_dbg_str("Success: Recurr spec present")?;
if let Some(until) = self.untildate { if let Some(until) = self.untildate {
debug!("Success: Until-Date present"); debug!("Success: Until-Date present");