From dd388e53bb317c45eaa64b927e5cd84b3be6a3e3 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 26 Nov 2018 18:13:12 +0100 Subject: [PATCH 1/4] Reimplement StoreId::to_str() without erroring Signed-off-by: Matthias Beyer --- lib/core/libimagstore/src/storeid.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/core/libimagstore/src/storeid.rs b/lib/core/libimagstore/src/storeid.rs index dbb061d4..c783e14b 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 { - 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 From 1ce780795a513dd473d216b03942dcafee9474c8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 26 Nov 2018 18:19:10 +0100 Subject: [PATCH 2/4] Do not use StoreId::local() here --- lib/entry/libimagentrylink/src/external.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 + 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 From d70a97191cd46fb6fd7c86588bf52d05f17b47b6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 26 Nov 2018 18:21:28 +0100 Subject: [PATCH 3/4] Simplify Display impl for Storeid --- lib/core/libimagstore/src/storeid.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/core/libimagstore/src/storeid.rs b/lib/core/libimagstore/src/storeid.rs index c783e14b..f57d24a8 100644 --- a/lib/core/libimagstore/src/storeid.rs +++ b/lib/core/libimagstore/src/storeid.rs @@ -187,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()) } } From 115002971d1b4bb5ac9c2af616417b9a9913f795 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 26 Nov 2018 20:16:35 +0100 Subject: [PATCH 4/4] travis: Update rustc because `encoding-rs` seems to need 1.29 as minimum version of the rust compiler. Signed-off-by: Matthias Beyer --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 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