From 642702b724e365ae67974bf4a0387dd54948f6e9 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 5 Dec 2018 19:01:42 +0100 Subject: [PATCH] Rewrite: StoreId::new_baseless() -> StoreId::new() Signed-off-by: Matthias Beyer --- bin/core/imag-link/src/main.rs | 8 ++++---- bin/core/imag-mv/src/main.rs | 4 ++-- bin/core/imag-tag/src/main.rs | 12 ++++++------ lib/core/libimagrt/src/runtime.rs | 2 +- lib/domain/libimagtimetrack/src/tag.rs | 2 +- .../libimagentrydatetime/src/datepath/compiler.rs | 2 +- lib/entry/libimagentrylink/src/internal.rs | 4 ++-- lib/entry/libimagentryref/src/refstore.rs | 4 ++-- lib/etc/libimaginteraction/src/ui.rs | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/bin/core/imag-link/src/main.rs b/bin/core/imag-link/src/main.rs index dc9be715..8f899d10 100644 --- a/bin/core/imag-link/src/main.rs +++ b/bin/core/imag-link/src/main.rs @@ -168,8 +168,8 @@ fn link_from_to<'a, I>(rt: &'a Runtime, from: &'a str, to: I) } else { debug!("Linking internally: {:?} -> {:?}", from, entry); - let from_id = StoreId::new_baseless(PathBuf::from(from)).map_err_trace_exit_unwrap(); - let entr_id = StoreId::new_baseless(PathBuf::from(entry)).map_err_trace_exit_unwrap(); + let from_id = StoreId::new(PathBuf::from(from)).map_err_trace_exit_unwrap(); + let entr_id = StoreId::new(PathBuf::from(entry)).map_err_trace_exit_unwrap(); if from_id == entr_id { error!("Cannot link entry with itself. Exiting"); @@ -366,13 +366,13 @@ mod tests { let mut path = PathBuf::new(); path.set_file_name(name); - let default_entry = Entry::new(StoreId::new_baseless(PathBuf::from("")).unwrap()) + let default_entry = Entry::new(StoreId::new(PathBuf::from("")).unwrap()) .to_str() .unwrap(); debug!("Default entry constructed"); - let id = StoreId::new_baseless(path)?; + let id = StoreId::new(path)?; debug!("StoreId constructed: {:?}", id); let mut entry = rt.store().create(id.clone())?; diff --git a/bin/core/imag-mv/src/main.rs b/bin/core/imag-mv/src/main.rs index ff267067..f5d4d341 100644 --- a/bin/core/imag-mv/src/main.rs +++ b/bin/core/imag-mv/src/main.rs @@ -72,7 +72,7 @@ fn main() { .cli() .value_of("source") .map(PathBuf::from) - .map(StoreId::new_baseless) + .map(StoreId::new) .unwrap() // unwrap safe by clap .map_err_trace_exit_unwrap(); @@ -80,7 +80,7 @@ fn main() { .cli() .value_of("dest") .map(PathBuf::from) - .map(StoreId::new_baseless) + .map(StoreId::new) .unwrap() // unwrap safe by clap .map_err_trace_exit_unwrap(); diff --git a/bin/core/imag-tag/src/main.rs b/bin/core/imag-tag/src/main.rs index ddf3fa70..e3ba7f20 100644 --- a/bin/core/imag-tag/src/main.rs +++ b/bin/core/imag-tag/src/main.rs @@ -264,11 +264,11 @@ mod tests { let mut path = PathBuf::new(); path.set_file_name(name); - let default_entry = Entry::new(StoreId::new_baseless(PathBuf::from("")).unwrap()) + let default_entry = Entry::new(StoreId::new(PathBuf::from("")).unwrap()) .to_str() .unwrap(); - let id = StoreId::new_baseless(path)?; + let id = StoreId::new(path)?; let mut entry = rt.store().create(id.clone())?; entry.get_content_mut().push_str(&default_entry); @@ -303,7 +303,7 @@ mod tests { debug!("Add-tags: {:?}", add); debug!("Altering things"); - alter(&rt, StoreId::new_baseless(id.clone()).unwrap(), add, None); + alter(&rt, StoreId::new(id.clone()).unwrap(), add, None); debug!("Altered"); let test_entry = rt.store().get(id).unwrap().unwrap(); @@ -338,7 +338,7 @@ mod tests { debug!("Rem-tags: {:?}", rem); debug!("Altering things"); - alter(&rt, StoreId::new_baseless(id.clone()).unwrap(), add, rem); + alter(&rt, StoreId::new(id.clone()).unwrap(), add, rem); debug!("Altered"); let test_entry = rt.store().get(id).unwrap().unwrap(); @@ -366,7 +366,7 @@ mod tests { debug!("Rem-tags: {:?}", rem); debug!("Altering things"); - alter(&rt, StoreId::new_baseless(id.clone()).unwrap(), add, rem); + alter(&rt, StoreId::new(id.clone()).unwrap(), add, rem); debug!("Altered"); let test_entry = rt.store().get(id).unwrap().unwrap(); @@ -394,7 +394,7 @@ mod tests { debug!("Rem-tags: {:?}", rem); debug!("Altering things"); - alter(&rt, StoreId::new_baseless(id.clone()).unwrap(), add, rem); + alter(&rt, StoreId::new(id.clone()).unwrap(), add, rem); debug!("Altered"); let test_entry = rt.store().get(id).unwrap().unwrap(); diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs index e5fd4041..4f2a485f 100644 --- a/lib/core/libimagrt/src/runtime.rs +++ b/lib/core/libimagrt/src/runtime.rs @@ -414,7 +414,7 @@ impl<'a> Runtime<'a> { trace!("Got IDs = {}", buf); buf.lines() .map(PathBuf::from) - .map(|id| StoreId::new_baseless(id).map_err(Error::from)) + .map(|id| StoreId::new(id).map_err(Error::from)) .collect() }) } else { diff --git a/lib/domain/libimagtimetrack/src/tag.rs b/lib/domain/libimagtimetrack/src/tag.rs index 2f099878..0bc96c42 100644 --- a/lib/domain/libimagtimetrack/src/tag.rs +++ b/lib/domain/libimagtimetrack/src/tag.rs @@ -65,7 +65,7 @@ impl<'a> From<&'a String> for TimeTrackingTag { impl IntoStoreId for TimeTrackingTag { fn into_storeid(self) -> Result { - StoreId::new_baseless(PathBuf::from(self.0)) + StoreId::new(PathBuf::from(self.0)) } } diff --git a/lib/entry/libimagentrydatetime/src/datepath/compiler.rs b/lib/entry/libimagentrydatetime/src/datepath/compiler.rs index 037803dc..d7515d16 100644 --- a/lib/entry/libimagentrydatetime/src/datepath/compiler.rs +++ b/lib/entry/libimagentrydatetime/src/datepath/compiler.rs @@ -119,7 +119,7 @@ impl DatePathCompiler { } } - StoreId::new_baseless(PathBuf::from(s)) + StoreId::new(PathBuf::from(s)) } } diff --git a/lib/entry/libimagentrylink/src/internal.rs b/lib/entry/libimagentrylink/src/internal.rs index 751f0b1e..7b092d24 100644 --- a/lib/entry/libimagentrylink/src/internal.rs +++ b/lib/entry/libimagentrylink/src/internal.rs @@ -568,7 +568,7 @@ fn process_rw_result(links: Result>) -> Result { .map(|link| { debug!("Matching the link: {:?}", link); match link { - Value::String(s) => StoreId::new_baseless(PathBuf::from(s)) + Value::String(s) => StoreId::new(PathBuf::from(s)) .map(|s| Link::Id { link: s }) .map_err(From::from) , @@ -588,7 +588,7 @@ fn process_rw_result(links: Result>) -> Result { debug!("Ok, here we go with building a Link::Annotated"); match (link, anno) { (Value::String(link), Value::String(anno)) => { - StoreId::new_baseless(PathBuf::from(link)) + StoreId::new(PathBuf::from(link)) .map_err(From::from) .map(|link| { Link::Annotated { diff --git a/lib/entry/libimagentryref/src/refstore.rs b/lib/entry/libimagentryref/src/refstore.rs index 58f05b7b..c378d6fd 100644 --- a/lib/entry/libimagentryref/src/refstore.rs +++ b/lib/entry/libimagentryref/src/refstore.rs @@ -91,7 +91,7 @@ impl<'a> RefStore<'a> for Store { fn get_ref>(&'a self, hash: H) -> Result>> { - let sid = StoreId::new_baseless(PathBuf::from(format!("{}/{}", RPG::collection(), hash.as_ref()))) + let sid = StoreId::new(PathBuf::from(format!("{}/{}", RPG::collection(), hash.as_ref()))) .map_err(Error::from)?; debug!("Getting: {:?}", sid); @@ -104,7 +104,7 @@ impl<'a> RefStore<'a> for Store { { let hash = RPG::unique_hash(&path)?; let pathbuf = PathBuf::from(format!("{}/{}", RPG::collection(), hash)); - let sid = StoreId::new_baseless(pathbuf.clone())?; + let sid = StoreId::new(pathbuf.clone())?; debug!("Creating: {:?}", sid); self.create(sid) diff --git a/lib/etc/libimaginteraction/src/ui.rs b/lib/etc/libimaginteraction/src/ui.rs index 09395d54..0ad099a7 100644 --- a/lib/etc/libimaginteraction/src/ui.rs +++ b/lib/etc/libimaginteraction/src/ui.rs @@ -55,7 +55,7 @@ pub fn get_id(matches: &ArgMatches) -> Result> { vals.into_iter() .fold(Ok(vec![]), |acc, elem| { acc.and_then(|mut v| { - let elem = StoreId::new_baseless(PathBuf::from(String::from(elem)))?; + let elem = StoreId::new(PathBuf::from(String::from(elem)))?; v.push(elem); Ok(v) }) @@ -70,7 +70,7 @@ pub fn get_or_select_id(matches: &ArgMatches, store_path: &PathBuf) -> Result