summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-12-05 19:01:42 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-02-15 20:53:28 +0100
commit642702b724e365ae67974bf4a0387dd54948f6e9 (patch)
treea1a85a752ff2b981b4c12d8af77472a51963fbf8
parentb66371f79b22fd017faacbc7120306b916bd2776 (diff)
Rewrite: StoreId::new_baseless() -> StoreId::new()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--bin/core/imag-link/src/main.rs8
-rw-r--r--bin/core/imag-mv/src/main.rs4
-rw-r--r--bin/core/imag-tag/src/main.rs12
-rw-r--r--lib/core/libimagrt/src/runtime.rs2
-rw-r--r--lib/domain/libimagtimetrack/src/tag.rs2
-rw-r--r--lib/entry/libimagentrydatetime/src/datepath/compiler.rs2
-rw-r--r--lib/entry/libimagentrylink/src/internal.rs4
-rw-r--r--lib/entry/libimagentryref/src/refstore.rs4
-rw-r--r--lib/etc/libimaginteraction/src/ui.rs4
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> {
- 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<Option<Value>>) -> Result<LinkIter> {
.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<Option<Value>>) -> Result<LinkIter> {
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<RPG: UniqueRefPathGenerator, H: AsRef<str>>(&'a self, hash: H)
-> Result<Option<FileLockEntry<'a>>>
{
- 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<Vec<StoreId>> {
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<Ve
.or_else(|_| {
let path = store_path.clone();
let p = pick_file(default_menu_cmd, path)?;
- let id = StoreId::new_baseless(p)?;
+ let id = StoreId::new(p)?;
Ok(vec![id])
})
}