diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2018-12-03 01:09:03 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2018-12-03 01:09:03 +0100 |
commit | 37ac37f22ea0e6773cd6e4bc03945f21a7f32231 (patch) | |
tree | c8d9bf4d3b764bab6fd44cea950c656dbb4b2533 | |
parent | 49b0b3a4141338f291e7522b6970173c5970489d (diff) | |
parent | 115002971d1b4bb5ac9c2af616417b9a9913f795 (diff) |
Merge branch 'minor'
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | lib/core/libimagstore/src/storeid.rs | 18 | ||||
-rw-r--r-- | lib/entry/libimagentrylink/src/external.rs | 2 |
3 files changed, 8 insertions, 16 deletions
diff --git a/.travis.yml b/.travis.yml index 8a42a2e3..7cb993e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ matrix: - bash ./scripts/branch-contains-no-tmp-commits - bash ./scripts/version-updated - language: rust - rust: 1.28.0 + rust: 1.29.2 cache: directories: - /home/travis/.cargo @@ -26,7 +26,7 @@ matrix: - cargo build --all --all-features -j 1 || exit 1 - cargo test --all --all-features -j 1 || exit 1 - language: rust - rust: 1.29.2 + rust: 1.30.1 cache: directories: - /home/travis/.cargo diff --git a/lib/core/libimagstore/src/storeid.rs b/lib/core/libimagstore/src/storeid.rs index dbb061d4..f57d24a8 100644 --- a/lib/core/libimagstore/src/storeid.rs +++ b/lib/core/libimagstore/src/storeid.rs @@ -120,15 +120,10 @@ impl StoreId { } pub fn to_str(&self) -> Result<String> { - self.base - .as_ref() - .cloned() - .map(|mut base| { base.push(self.id.clone()); base }) - .unwrap_or_else(|| self.id.clone()) - .to_str() - .map(String::from) - .ok_or_else(|| err_msg("Store ID Handling error")) - .map_err(Error::from) + match self.base.as_ref() { + None => Ok(self.id.display().to_string()), + Some(ref base) => Ok(format!("{}/{}", base.display(), self.id.display())), + } } /// Helper function for creating a displayable String from StoreId @@ -192,10 +187,7 @@ impl StoreId { impl Display for StoreId { fn fmt(&self, fmt: &mut Formatter) -> RResult<(), FmtError> { - match self.id.to_str() { - Some(s) => write!(fmt, "{}", s), - None => write!(fmt, "{}", self.id.to_string_lossy()), - } + write!(fmt, "{}", self.id.display()) } } diff --git a/lib/entry/libimagentrylink/src/external.rs b/lib/entry/libimagentrylink/src/external.rs index d4c6956b..143188f6 100644 --- a/lib/entry/libimagentrylink/src/external.rs +++ b/lib/entry/libimagentrylink/src/external.rs @@ -301,7 +301,7 @@ pub mod iter { /// Check whether the StoreId starts with `/link/external/` pub fn is_external_link_storeid<A: AsRef<StoreId> + Debug>(id: A) -> bool { debug!("Checking whether this is a 'links/external/': '{:?}'", id); - id.as_ref().local().starts_with("links/external") + id.as_ref().is_in_collection(&["links", "external"]) } /// Implement `ExternalLinker` for `Entry`, hiding the fact that there is no such thing as an external |