Merge branch 'minor'

This commit is contained in:
Matthias Beyer 2018-12-03 01:09:03 +01:00
commit 37ac37f22e
3 changed files with 8 additions and 16 deletions

View file

@ -16,7 +16,7 @@ matrix:
- bash ./scripts/branch-contains-no-tmp-commits - bash ./scripts/branch-contains-no-tmp-commits
- bash ./scripts/version-updated - bash ./scripts/version-updated
- language: rust - language: rust
rust: 1.28.0 rust: 1.29.2
cache: cache:
directories: directories:
- /home/travis/.cargo - /home/travis/.cargo
@ -26,7 +26,7 @@ matrix:
- cargo build --all --all-features -j 1 || exit 1 - cargo build --all --all-features -j 1 || exit 1
- cargo test --all --all-features -j 1 || exit 1 - cargo test --all --all-features -j 1 || exit 1
- language: rust - language: rust
rust: 1.29.2 rust: 1.30.1
cache: cache:
directories: directories:
- /home/travis/.cargo - /home/travis/.cargo

View file

@ -120,15 +120,10 @@ impl StoreId {
} }
pub fn to_str(&self) -> Result<String> { pub fn to_str(&self) -> Result<String> {
self.base match self.base.as_ref() {
.as_ref() None => Ok(self.id.display().to_string()),
.cloned() Some(ref base) => Ok(format!("{}/{}", base.display(), self.id.display())),
.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)
} }
/// Helper function for creating a displayable String from StoreId /// Helper function for creating a displayable String from StoreId
@ -192,10 +187,7 @@ impl StoreId {
impl Display for StoreId { impl Display for StoreId {
fn fmt(&self, fmt: &mut Formatter) -> RResult<(), FmtError> { fn fmt(&self, fmt: &mut Formatter) -> RResult<(), FmtError> {
match self.id.to_str() { write!(fmt, "{}", self.id.display())
Some(s) => write!(fmt, "{}", s),
None => write!(fmt, "{}", self.id.to_string_lossy()),
}
} }
} }

View file

@ -301,7 +301,7 @@ pub mod iter {
/// Check whether the StoreId starts with `/link/external/` /// Check whether the StoreId starts with `/link/external/`
pub fn is_external_link_storeid<A: AsRef<StoreId> + Debug>(id: A) -> bool { pub fn is_external_link_storeid<A: AsRef<StoreId> + Debug>(id: A) -> bool {
debug!("Checking whether this is a 'links/external/': '{:?}'", id); 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 /// Implement `ExternalLinker` for `Entry`, hiding the fact that there is no such thing as an external