From ad18fdd60434f7388ec44c0ecb49f8b555d3ea81 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:05:34 +0200 Subject: [PATCH 01/19] imag-link: Replace .err().unwrap() with .unwrap_err() --- imag-link/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/imag-link/src/main.rs b/imag-link/src/main.rs index d20bbac3..70f1d019 100644 --- a/imag-link/src/main.rs +++ b/imag-link/src/main.rs @@ -53,7 +53,7 @@ fn main() { rt.unwrap() } else { println!("Could not set up Runtime"); - println!("{:?}", rt.err().unwrap()); + println!("{:?}", rt.unwrap_err()); exit(1); } }; @@ -200,7 +200,7 @@ fn handle_external_linking(rt: &Runtime) { let entry_name = scmd.value_of("id").unwrap(); // enforced by clap let entry = get_entry_by_name(rt, entry_name); if entry.is_err() { - trace_error(&entry.err().unwrap()); + trace_error(&entry.unwrap_err()); exit(1); } let mut entry = entry.unwrap(); @@ -238,7 +238,7 @@ fn add_link_to_entry(store: &Store, matches: &ArgMatches, entry: &mut FileLockEn let link = Url::parse(link); if link.is_err() { debug!("URL parsing error..."); - trace_error(&link.err().unwrap()); + trace_error(&link.unwrap_err()); debug!("Exiting"); exit(1); } @@ -258,7 +258,7 @@ fn remove_link_from_entry(store: &Store, matches: &ArgMatches, entry: &mut FileL let link = Url::parse(link); if link.is_err() { - trace_error(&link.err().unwrap()); + trace_error(&link.unwrap_err()); exit(1); } let link = link.unwrap(); From da3b463ff007b78921fa0e78d2ed3eab8255f1e8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:07:14 +0200 Subject: [PATCH 02/19] imag-counter: Replace .err().unwrap() with .unwrap_err() --- imag-counter/src/list.rs | 4 ++-- imag-counter/src/main.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/imag-counter/src/list.rs b/imag-counter/src/list.rs index 2d1c80bb..b7276957 100644 --- a/imag-counter/src/list.rs +++ b/imag-counter/src/list.rs @@ -15,11 +15,11 @@ pub fn list(rt: &Runtime) { let value = c.value(); if name.is_err() { - trace_error(&name.err().unwrap()); + trace_error(&name.unwrap_err()); } else { if value.is_err() { - trace_error(&value.err().unwrap()); + trace_error(&value.unwrap_err()); } else { println!("{} - {}", name.unwrap(), value.unwrap()); } diff --git a/imag-counter/src/main.rs b/imag-counter/src/main.rs index 964556e3..538149dc 100644 --- a/imag-counter/src/main.rs +++ b/imag-counter/src/main.rs @@ -59,7 +59,7 @@ fn main() { rt.unwrap() } else { println!("Could not set up Runtime"); - println!("{:?}", rt.err().unwrap()); + println!("{:?}", rt.unwrap_err()); exit(1); } }; From 85800e77587e393155adb25234091306fbe0b618 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:07:31 +0200 Subject: [PATCH 03/19] imag-notes: Replace .err().unwrap() with .unwrap_err() --- imag-notes/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imag-notes/src/main.rs b/imag-notes/src/main.rs index 1c6dedfb..bea757fa 100644 --- a/imag-notes/src/main.rs +++ b/imag-notes/src/main.rs @@ -29,7 +29,7 @@ fn main() { rt.unwrap() } else { println!("Could not set up Runtime"); - println!("{:?}", rt.err().unwrap()); + println!("{:?}", rt.unwrap_err()); exit(1); } }; @@ -81,7 +81,7 @@ fn edit(rt: &Runtime) { fn edit_entry(rt: &Runtime, name: String) -> bool { let note = Note::retrieve(rt.store(), name); if note.is_err() { - trace_error(¬e.err().unwrap()); + trace_error(¬e.unwrap_err()); warn!("Cannot edit nonexistent Note"); return false } @@ -100,7 +100,7 @@ fn list(rt: &Runtime) { let iter = Note::all_notes(rt.store()); if iter.is_err() { - trace_error(&iter.err().unwrap()); + trace_error(&iter.unwrap_err()); exit(1); } From cd73be256b22404c342bad782c2e1453f3e5f526 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:07:39 +0200 Subject: [PATCH 04/19] imag-store: Replace .err().unwrap() with .unwrap_err() --- imag-store/src/create.rs | 2 +- imag-store/src/delete.rs | 2 +- imag-store/src/main.rs | 2 +- imag-store/src/retrieve.rs | 2 +- imag-store/src/update.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/imag-store/src/create.rs b/imag-store/src/create.rs index 9d90f642..35ac162a 100644 --- a/imag-store/src/create.rs +++ b/imag-store/src/create.rs @@ -38,7 +38,7 @@ pub fn create(rt: &Runtime) { let path = build_entry_path(rt.store(), path.unwrap()); if path.is_err() { - trace_error(&path.err().unwrap()); + trace_error(&path.unwrap_err()); exit(1); } let path = path.unwrap(); diff --git a/imag-store/src/delete.rs b/imag-store/src/delete.rs index 71bf0f91..f232ec0a 100644 --- a/imag-store/src/delete.rs +++ b/imag-store/src/delete.rs @@ -14,7 +14,7 @@ pub fn delete(rt: &Runtime) { .map(|id| { let path = build_entry_path(rt.store(), id); if path.is_err() { - trace_error(&path.err().unwrap()); + trace_error(&path.unwrap_err()); exit(1); } let path = path.unwrap(); diff --git a/imag-store/src/main.rs b/imag-store/src/main.rs index 4b5968d7..034e2b15 100644 --- a/imag-store/src/main.rs +++ b/imag-store/src/main.rs @@ -36,7 +36,7 @@ fn main() { rt.unwrap() } else { println!("Could not set up Runtime"); - println!("{:?}", rt.err().unwrap()); + println!("{:?}", rt.unwrap_err()); exit(1); } }; diff --git a/imag-store/src/retrieve.rs b/imag-store/src/retrieve.rs index cc43ece2..8fbeeda3 100644 --- a/imag-store/src/retrieve.rs +++ b/imag-store/src/retrieve.rs @@ -19,7 +19,7 @@ pub fn retrieve(rt: &Runtime) { .map(|id| { let path = build_entry_path(rt.store(), id); if path.is_err() { - trace_error(&path.err().unwrap()); + trace_error(&path.unwrap_err()); exit(1); } let path = path.unwrap(); diff --git a/imag-store/src/update.rs b/imag-store/src/update.rs index d37da1c2..0e054106 100644 --- a/imag-store/src/update.rs +++ b/imag-store/src/update.rs @@ -16,7 +16,7 @@ pub fn update(rt: &Runtime) { .map(|id| { let path = build_entry_path(rt.store(), id); if path.is_err() { - trace_error(&path.err().unwrap()); + trace_error(&path.unwrap_err()); exit(1); } let path = path.unwrap(); From c8e5ea49ce05293268a586f082c2e5c4ee50bdde Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:07:47 +0200 Subject: [PATCH 05/19] imag-tag: Replace .err().unwrap() with .unwrap_err() --- imag-tag/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imag-tag/src/main.rs b/imag-tag/src/main.rs index 2b6201dc..e1a35a34 100644 --- a/imag-tag/src/main.rs +++ b/imag-tag/src/main.rs @@ -32,7 +32,7 @@ fn main() { rt.unwrap() } else { println!("Could not set up Runtime"); - println!("{:?}", rt.err().unwrap()); + println!("{:?}", rt.unwrap_err()); exit(1); } }; @@ -127,7 +127,7 @@ fn list(id: &str, rt: &Runtime) { if entry.is_err() { debug!("Could not retrieve '{:?}' => {:?}", id, path); warn!("Could not retrieve entry '{}'", id); - trace_error(&entry.err().unwrap()); + trace_error(&entry.unwrap_err()); exit(1); } let entry = entry.unwrap(); @@ -146,7 +146,7 @@ fn list(id: &str, rt: &Runtime) { let tags = entry.get_tags(); if tags.is_err() { - trace_error(&tags.err().unwrap()); + trace_error(&tags.unwrap_err()); exit(1); } let tags = tags.unwrap(); From c1b4ce55b5d1a68bd0183261b47cb092c0af8671 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:07:57 +0200 Subject: [PATCH 06/19] imag-view: Replace .err().unwrap() with .unwrap_err() --- imag-view/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imag-view/src/main.rs b/imag-view/src/main.rs index 1f18ca17..f12e639d 100644 --- a/imag-view/src/main.rs +++ b/imag-view/src/main.rs @@ -54,7 +54,7 @@ fn main() { rt.unwrap() } else { println!("Could not set up Runtime"); - println!("{:?}", rt.err().unwrap()); + println!("{:?}", rt.unwrap_err()); exit(1); // we can afford not-executing destructors here } }; @@ -102,7 +102,7 @@ fn main() { let entry = load_entry(entry_id, entry_version, &rt); if entry.is_err() { - trace_error(&entry.err().unwrap()); + trace_error(&entry.unwrap_err()); exit(1); // we can afford not-executing destructors here } let entry = entry.unwrap(); From d01c2d294ec3b3a7afad40499e432f7c9cab2519 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:08:05 +0200 Subject: [PATCH 07/19] libimagcounter: Replace .err().unwrap() with .unwrap_err() --- libimagcounter/src/counter.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libimagcounter/src/counter.rs b/libimagcounter/src/counter.rs index bea7537e..c245e261 100644 --- a/libimagcounter/src/counter.rs +++ b/libimagcounter/src/counter.rs @@ -30,7 +30,7 @@ impl<'a> Counter<'a> { let fle = { let lockentry = store.create(ModuleEntryPath::new(name.clone()).into_storeid()); if lockentry.is_err() { - return Err(CE::new(CEK::StoreWriteError, Some(Box::new(lockentry.err().unwrap())))); + return Err(CE::new(CEK::StoreWriteError, Some(Box::new(lockentry.unwrap_err())))); } let mut lockentry = lockentry.unwrap(); @@ -39,17 +39,17 @@ impl<'a> Counter<'a> { let mut header = entry.get_header_mut(); let setres = header.set("counter", Value::Table(BTreeMap::new())); if setres.is_err() { - return Err(CE::new(CEK::StoreWriteError, Some(Box::new(setres.err().unwrap())))); + return Err(CE::new(CEK::StoreWriteError, Some(Box::new(setres.unwrap_err())))); } let setres = header.set("counter.name", Value::String(name)); if setres.is_err() { - return Err(CE::new(CEK::StoreWriteError, Some(Box::new(setres.err().unwrap())))); + return Err(CE::new(CEK::StoreWriteError, Some(Box::new(setres.unwrap_err())))); } let setres = header.set("counter.value", Value::Integer(init)); if setres.is_err() { - return Err(CE::new(CEK::StoreWriteError, Some(Box::new(setres.err().unwrap())))); + return Err(CE::new(CEK::StoreWriteError, Some(Box::new(setres.unwrap_err())))); } } From 5d2950b7df890094343da69d5dfab145e63c91a7 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:08:16 +0200 Subject: [PATCH 08/19] libimagentrylink: Replace .err().unwrap() with .unwrap_err() --- libimagentrylink/src/external.rs | 2 +- libimagentrylink/src/internal.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libimagentrylink/src/external.rs b/libimagentrylink/src/external.rs index 9df53cca..6adb8a80 100644 --- a/libimagentrylink/src/external.rs +++ b/libimagentrylink/src/external.rs @@ -173,7 +173,7 @@ impl ExternalLinker for Entry { let file = store.retrieve(file_id.clone()); if file.is_err() { debug!("Failed to create or retrieve an file for this link '{:?}'", link); - return Err(LE::new(LEK::StoreWriteError, Some(Box::new(file.err().unwrap())))); + return Err(LE::new(LEK::StoreWriteError, Some(Box::new(file.unwrap_err())))); } let mut file = file.unwrap(); diff --git a/libimagentrylink/src/internal.rs b/libimagentrylink/src/internal.rs index e22214d1..a410349a 100644 --- a/libimagentrylink/src/internal.rs +++ b/libimagentrylink/src/internal.rs @@ -139,7 +139,7 @@ fn process_rw_result(links: StoreResult>) -> Result> { if links.is_err() { debug!("RW action on store failed. Generating LinkError"); let lerr = LinkError::new(LinkErrorKind::EntryHeaderReadError, - Some(Box::new(links.err().unwrap()))); + Some(Box::new(links.unwrap_err()))); return Err(lerr); } let links = links.unwrap(); From e08986842c5a1602adde82d8f9eecd948e7c4975 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:08:27 +0200 Subject: [PATCH 09/19] libimagentrytag: Replace .err().unwrap() with .unwrap_err() --- libimagentrytag/src/tagable.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libimagentrytag/src/tagable.rs b/libimagentrytag/src/tagable.rs index bd478a97..4dbe4efb 100644 --- a/libimagentrytag/src/tagable.rs +++ b/libimagentrytag/src/tagable.rs @@ -31,7 +31,7 @@ impl Tagable for EntryHeader { let tags = self.read("imag.tags"); if tags.is_err() { let kind = TagErrorKind::HeaderReadError; - return Err(TagError::new(kind, Some(Box::new(tags.err().unwrap())))); + return Err(TagError::new(kind, Some(Box::new(tags.unwrap_err())))); } let tags = tags.unwrap(); @@ -106,7 +106,7 @@ impl Tagable for EntryHeader { let tags = self.read("imag.tags"); if tags.is_err() { let kind = TagErrorKind::HeaderReadError; - return Err(TagError::new(kind, Some(Box::new(tags.err().unwrap())))); + return Err(TagError::new(kind, Some(Box::new(tags.unwrap_err())))); } let tags = tags.unwrap(); @@ -129,7 +129,7 @@ impl Tagable for EntryHeader { for tag in tags { let check = self.has_tag(tag); if check.is_err() { - return Err(check.err().unwrap()); + return Err(check.unwrap_err()); } let check = check.unwrap(); From 9ada2d9c98b2bde10b7556f4a62b0cc40b2af329 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:08:37 +0200 Subject: [PATCH 10/19] libimagnotes: Replace .err().unwrap() with .unwrap_err() --- libimagnotes/src/note.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libimagnotes/src/note.rs b/libimagnotes/src/note.rs index 4f30b3c6..0487cb1c 100644 --- a/libimagnotes/src/note.rs +++ b/libimagnotes/src/note.rs @@ -32,7 +32,7 @@ impl<'a> Note<'a> { let fle = { let lockentry = store.create(ModuleEntryPath::new(name.clone()).into_storeid()); if lockentry.is_err() { - return Err(NE::new(NEK::StoreWriteError, Some(Box::new(lockentry.err().unwrap())))); + return Err(NE::new(NEK::StoreWriteError, Some(Box::new(lockentry.unwrap_err())))); } let mut lockentry = lockentry.unwrap(); @@ -44,13 +44,13 @@ impl<'a> Note<'a> { let setres = header.set("note", Value::Table(BTreeMap::new())); if setres.is_err() { let kind = NEK::StoreWriteError; - return Err(NE::new(kind, Some(Box::new(setres.err().unwrap())))); + return Err(NE::new(kind, Some(Box::new(setres.unwrap_err())))); } let setres = header.set("note.name", Value::String(name)); if setres.is_err() { let kind = NEK::StoreWriteError; - return Err(NE::new(kind, Some(Box::new(setres.err().unwrap())))); + return Err(NE::new(kind, Some(Box::new(setres.unwrap_err())))); } } From 3631817827c9f9051946cc82d7090183f3e88272 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:08:44 +0200 Subject: [PATCH 11/19] libimagrt: Replace .err().unwrap() with .unwrap_err() --- libimagrt/src/runtime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libimagrt/src/runtime.rs b/libimagrt/src/runtime.rs index b89bf5b4..794dc3d7 100644 --- a/libimagrt/src/runtime.rs +++ b/libimagrt/src/runtime.rs @@ -73,7 +73,7 @@ impl<'a> Runtime<'a> { let cfg = Configuration::new(&rtp); let cfg = if cfg.is_err() { - let e = cfg.err().unwrap(); + let e = cfg.unwrap_err(); if e.err_type() != ConfigErrorKind::NoConfigFileFound { let cause : Option> = Some(Box::new(e)); return Err(RuntimeError::new(RuntimeErrorKind::Instantiate, cause)); From 0bb40fca111e9e19703e86bb8636dc389ca598de Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Apr 2016 21:08:54 +0200 Subject: [PATCH 12/19] libimagstore: Replace .err().unwrap() with .unwrap_err() --- libimagstore/src/store.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index fe38518c..87221253 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -156,7 +156,7 @@ impl Store { if c.is_err() { debug!("Failed"); return Err(StoreError::new(StoreErrorKind::StorePathCreate, - Some(Box::new(c.err().unwrap())))); + Some(Box::new(c.unwrap_err())))); } } else { if location.is_file() { @@ -434,7 +434,7 @@ impl Store { if guard.is_err() { return Err(StoreError::new(StoreErrorKind::HookRegisterError, - Some(Box::new(guard.err().unwrap())))); + Some(Box::new(guard.unwrap_err())))); } let mut guard = guard.unwrap(); for mut aspect in guard.deref_mut() { @@ -764,7 +764,7 @@ impl EntryHeader { pub fn set_with_sep(&mut self, spec: &str, sep: char, v: Value) -> Result> { let tokens = EntryHeader::tokenize(spec, sep); if tokens.is_err() { // return parser error if any - return Err(tokens.err().unwrap()); + return Err(tokens.unwrap_err()); } let tokens = tokens.unwrap(); debug!("tokens = {:?}", tokens); @@ -779,7 +779,7 @@ impl EntryHeader { let path_to_dest = tokens[..(tokens.len() - 1)].into(); // N - 1 tokens let value = EntryHeader::walk_header(&mut self.header, path_to_dest); // walk N-1 tokens if value.is_err() { - return Err(value.err().unwrap()); + return Err(value.unwrap_err()); } let mut value = value.unwrap(); debug!("walked value = {:?}", value); @@ -871,14 +871,14 @@ impl EntryHeader { pub fn read_with_sep(&self, spec: &str, splitchr: char) -> Result> { let tokens = EntryHeader::tokenize(spec, splitchr); if tokens.is_err() { // return parser error if any - return Err(tokens.err().unwrap()); + return Err(tokens.unwrap_err()); } let tokens = tokens.unwrap(); let mut header_clone = self.header.clone(); // we clone as READing is simpler this way let value = EntryHeader::walk_header(&mut header_clone, tokens); // walk N-1 tokens if value.is_err() { - let e = value.err().unwrap(); + let e = value.unwrap_err(); return match e.err_type() { // We cannot find the header key, as there is no path to it StoreErrorKind::HeaderKeyNotFound => Ok(None), @@ -891,7 +891,7 @@ impl EntryHeader { pub fn delete(&mut self, spec: &str) -> Result> { let tokens = EntryHeader::tokenize(spec, '.'); if tokens.is_err() { // return parser error if any - return Err(tokens.err().unwrap()); + return Err(tokens.unwrap_err()); } let tokens = tokens.unwrap(); @@ -905,7 +905,7 @@ impl EntryHeader { let path_to_dest = tokens[..(tokens.len() - 1)].into(); // N - 1 tokens let value = EntryHeader::walk_header(&mut self.header, path_to_dest); // walk N-1 tokens if value.is_err() { - return Err(value.err().unwrap()); + return Err(value.unwrap_err()); } let mut value = value.unwrap(); debug!("walked value = {:?}", value); From 01c226f0ca201d12c740626fae52f1b27e99a369 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Apr 2016 09:08:47 +0200 Subject: [PATCH 13/19] Revert change to unwrap_err() here, trait bounds not fulfilled --- libimagstore/src/store.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 87221253..445af899 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -434,7 +434,7 @@ impl Store { if guard.is_err() { return Err(StoreError::new(StoreErrorKind::HookRegisterError, - Some(Box::new(guard.unwrap_err())))); + Some(Box::new(guard.err().unwrap())))); } let mut guard = guard.unwrap(); for mut aspect in guard.deref_mut() { From 381a9b3f5b2ba3b7857f110bdfa8d8a2d72fde42 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Apr 2016 10:54:50 +0200 Subject: [PATCH 14/19] Revert change to unwrap_err() here, trait bounds not fulfilled --- libimagcounter/src/counter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libimagcounter/src/counter.rs b/libimagcounter/src/counter.rs index c245e261..2285071f 100644 --- a/libimagcounter/src/counter.rs +++ b/libimagcounter/src/counter.rs @@ -30,7 +30,7 @@ impl<'a> Counter<'a> { let fle = { let lockentry = store.create(ModuleEntryPath::new(name.clone()).into_storeid()); if lockentry.is_err() { - return Err(CE::new(CEK::StoreWriteError, Some(Box::new(lockentry.unwrap_err())))); + return Err(CE::new(CEK::StoreWriteError, Some(Box::new(lockentry.err().unwrap())))); } let mut lockentry = lockentry.unwrap(); From e0876bb7512f10594d51f036d31f44275b158e80 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Apr 2016 14:02:57 +0200 Subject: [PATCH 15/19] Make libimagrt::runtime::Runtime derive Debug --- libimagrt/src/runtime.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagrt/src/runtime.rs b/libimagrt/src/runtime.rs index 794dc3d7..7319958f 100644 --- a/libimagrt/src/runtime.rs +++ b/libimagrt/src/runtime.rs @@ -17,6 +17,7 @@ use logger::ImagLogger; use libimagstore::store::Store; +#[derive(Debug)] pub struct Runtime<'a> { rtp: PathBuf, configuration: Option, From 872114d86f18d372df9c0addf3a1ae733c71cabe Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Apr 2016 14:52:21 +0200 Subject: [PATCH 16/19] FileLockEntry: Derive Debug --- libimagstore/src/store.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 445af899..c47299ee 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -537,6 +537,7 @@ impl Drop for Store { } /// A struct that allows you to borrow an Entry +#[derive(Debug)] pub struct FileLockEntry<'a> { store: &'a Store, entry: Entry, From 90b4e3cc62b89aef5257d409d817880f3e4febd9 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Apr 2016 15:58:35 +0200 Subject: [PATCH 17/19] Add derive(Debug) for Note --- libimagnotes/src/note.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagnotes/src/note.rs b/libimagnotes/src/note.rs index 0487cb1c..24975d35 100644 --- a/libimagnotes/src/note.rs +++ b/libimagnotes/src/note.rs @@ -19,6 +19,7 @@ use result::Result; use error::NoteError as NE; use error::NoteErrorKind as NEK; +#[derive(Debug)] pub struct Note<'a> { entry: FileLockEntry<'a>, } From b909fea45b63e346ba2eb5cd1d391edbd94a72bc Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Apr 2016 18:23:47 +0200 Subject: [PATCH 18/19] Derive Debug for NoteIterator --- libimagnotes/src/note.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagnotes/src/note.rs b/libimagnotes/src/note.rs index 24975d35..b5cc7063 100644 --- a/libimagnotes/src/note.rs +++ b/libimagnotes/src/note.rs @@ -172,6 +172,7 @@ impl<'a> Deref for Note<'a> { } +#[derive(Debug)] pub struct NoteIterator<'a> { store: &'a Store, iditer: StoreIdIterator, From fd9dee7dea44e372105f712bd0ff2bbd3daf760c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Apr 2016 18:40:59 +0200 Subject: [PATCH 19/19] Implement Debug for StoreIdIterator --- libimagstore/src/storeid.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libimagstore/src/storeid.rs b/libimagstore/src/storeid.rs index 35c3c0f8..7c5940c1 100644 --- a/libimagstore/src/storeid.rs +++ b/libimagstore/src/storeid.rs @@ -1,6 +1,9 @@ use std::path::PathBuf; use glob::Paths; use semver::Version; +use std::fmt::{Debug, Formatter}; +use std::fmt::Error as FmtError; +use std::result::Result as RResult; use error::{StoreError, StoreErrorKind}; use store::Result; @@ -94,6 +97,14 @@ pub struct StoreIdIterator { paths: Paths, } +impl Debug for StoreIdIterator { + + fn fmt(&self, fmt: &mut Formatter) -> RResult<(), FmtError> { + write!(fmt, "StoreIdIterator") + } + +} + impl StoreIdIterator { pub fn new(paths: Paths) -> StoreIdIterator {