summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-12-22 18:59:07 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-12-23 11:17:44 +0100
commit43b9f6a0f39eced0eb59aca9008d859bc6e14449 (patch)
tree61b8d7b81448de6fc2072cb999da1ba3d5e60bbe /lib
parent8ffb06cef3ac7a066a74121abd406f731073b8a0 (diff)
Replace map_dbg() and map_dbg_str() with context() and inspect() calls
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/core/libimagrt/src/runtime.rs2
-rw-r--r--lib/domain/libimaghabit/src/habit.rs15
-rw-r--r--lib/entry/libimagentrylink/src/storecheck.rs36
-rw-r--r--lib/entry/libimagentryurl/src/iter.rs2
4 files changed, 21 insertions, 34 deletions
diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs
index a1a27c6c..0c53b7e7 100644
--- a/lib/core/libimagrt/src/runtime.rs
+++ b/lib/core/libimagrt/src/runtime.rs
@@ -384,8 +384,8 @@ impl<'a> Runtime<'a> {
})
.or_else(|_| env::var("EDITOR"))
.map_err(|_| Error::from(EM::IO))
- .map_dbg(|s| format!("Editing with '{}'", s))
.and_then(|s| {
+ debug!("Editing with '{}'", s);
let mut split = s.split_whitespace();
let command = split.next();
if command.is_none() {
diff --git a/lib/domain/libimaghabit/src/habit.rs b/lib/domain/libimaghabit/src/habit.rs
index bcf0aa3f..8ec5afa6 100644
--- a/lib/domain/libimaghabit/src/habit.rs
+++ b/lib/domain/libimaghabit/src/habit.rs
@@ -321,17 +321,14 @@ pub mod builder {
format_err!("Habit builder missing: {}", s)
}
- let name = self.name
- .ok_or_else(|| mkerr("name"))
- .map_dbg_str("Success: Name present")?;
+ let name = self.name.ok_or_else(|| mkerr("name"))?;
+ debug!("Success: Name present");
- let dateobj = self.basedate
- .ok_or_else(|| mkerr("date"))
- .map_dbg_str("Success: Date present")?;
+ let dateobj = self.basedate.ok_or_else(|| mkerr("date"))?;
+ debug!("Success: Date present");
- let recur : String = self.recurspec
- .ok_or_else(|| mkerr("recurspec"))
- .map_dbg_str("Success: Recurr spec present")?;
+ let recur : String = self.recurspec.ok_or_else(|| mkerr("recurspec"))?;
+ debug!("Success: Recurr spec present");
if let Some(until) = self.untildate {
debug!("Success: Until-Date present");
diff --git a/lib/entry/libimagentrylink/src/storecheck.rs b/lib/entry/libimagentrylink/src/storecheck.rs
index eab8eccf..b57448f0 100644
--- a/lib/entry/libimagentrylink/src/storecheck.rs
+++ b/lib/entry/libimagentrylink/src/storecheck.rs
@@ -145,29 +145,19 @@ impl StoreLinkConsistentExt for Store {
Ok(())
};
- aggregate_link_network(&self)
- .map_dbg_str("Aggregated")
- .map_dbg(|nw| {
- let mut s = String::new();
- for (k, v) in nw {
- s.push_str(&format!("{}\n in: {:?}\n out: {:?}", k, v.incoming, v.outgoing));
- }
- s
- })
- .and_then(|nw| {
- all_collected_storeids_exist(&nw)
- .map(|_| nw)
- .context(err_msg("Link handling error"))
- .map_err(Error::from)
- })
- .and_then(|nw| {
- for (id, linking) in nw.iter() {
- incoming_links_exists_as_outgoing_links(id, linking, &nw)?;
- outgoing_links_exist_as_incoming_links(id, linking, &nw)?;
- }
- Ok(())
- })
- .map(|_| ())
+ let nw = aggregate_link_network(&self)?;
+
+ for (k, v) in nw.iter() {
+ debug!("{}\n in: {:?}\n out: {:?}", k, v.incoming, v.outgoing);
+ }
+
+ all_collected_storeids_exist(&nw).context("Link handling error")?;
+
+ for (id, linking) in nw.iter() {
+ incoming_links_exists_as_outgoing_links(id, linking, &nw)?;
+ outgoing_links_exist_as_incoming_links(id, linking, &nw)?;
+ }
+ Ok(())
}
}
diff --git a/lib/entry/libimagentryurl/src/iter.rs b/lib/entry/libimagentryurl/src/iter.rs
index eb60e6bd..f6cc703e 100644
--- a/lib/entry/libimagentryurl/src/iter.rs
+++ b/lib/entry/libimagentryurl/src/iter.rs
@@ -178,7 +178,7 @@ impl<'a> Iterator for UrlIter<'a> {
debug!("Store::retrieve({:?}) succeeded", id);
debug!("getting uri link from file now");
f.get_url()
- .map_dbg_str("Error happened while getting link URI from FLE")
+ .context("Error happened while getting link URI from FLE")
.with_context(|e| format!("URL -> Err = {:?}", e))
.map_err(Error::from)
})