diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-04-09 19:19:40 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-04-13 22:39:39 +0200 |
commit | cb4d5367e44528a09a6e2cb36f4e7dc5cf85dbfb (patch) | |
tree | 34b17bb492986ef850fbb1388804e56ca5e6f28e /lib/entry/libimagentrylink/src/external.rs | |
parent | de522ec0f2acc4e3651f77fdbe7f5295b6702c0d (diff) |
Rewrite all usages of ModuleEntryPath
Because the code was so complex before, we had to create an object and
then cast that object into a `StoreId` rather than just creating a
`StoreId` object right away.
With this patch, we're using the code-generation approach to generate a
function that creates a `StoreId` object based on the name of the
current module. That's way easier and error handling was also improved
by the switch to the new implementation.
The patch also includes a rewrite of all usages of ModuleEntryPath and
changes them to `module_path::new_id()` calls.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib/entry/libimagentrylink/src/external.rs')
-rw-r--r-- | lib/entry/libimagentrylink/src/external.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/entry/libimagentrylink/src/external.rs b/lib/entry/libimagentrylink/src/external.rs index bfce70a7..93627235 100644 --- a/lib/entry/libimagentrylink/src/external.rs +++ b/lib/entry/libimagentrylink/src/external.rs @@ -37,7 +37,6 @@ use std::fmt::Debug; use libimagstore::store::Entry; use libimagstore::store::Store; use libimagstore::storeid::StoreId; -use libimagstore::storeid::IntoStoreId; use libimagutil::debug_result::*; use libimagerror::errors::ErrorMsg as EM; @@ -50,7 +49,6 @@ use failure::ResultExt; use failure::err_msg; use internal::InternalLinker; -use module_path::ModuleEntryPath; use self::iter::*; @@ -337,12 +335,10 @@ impl ExternalLinker for Entry { debug!("Iterating {} links = {:?}", links.len(), links); links.into_iter().map(|link| { let hash = hex::encode(Sha1::digest(&link.as_str().as_bytes())); - let file_id = - ModuleEntryPath::new(format!("external/{}", hash)).into_storeid() - .map_dbg_err(|_| { - format!("Failed to build StoreId for this hash '{:?}'", hash) - }) - ?; + let file_id = ::module_path::new_id(format!("external/{}", hash)) + .map_dbg_err(|_| { + format!("Failed to build StoreId for this hash '{:?}'", hash) + })?; debug!("Link = '{:?}'", link); debug!("Hash = '{:?}'", hash); |