From 2328c8b2b01c60395aafce04cdd60596656c2696 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 13 Feb 2018 23:39:43 +0100 Subject: [PATCH] Take AsRef rather than &String --- lib/entry/libimagentryref/src/refstore.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/entry/libimagentryref/src/refstore.rs b/lib/entry/libimagentryref/src/refstore.rs index 69a96eb8..c428efb2 100644 --- a/lib/entry/libimagentryref/src/refstore.rs +++ b/lib/entry/libimagentryref/src/refstore.rs @@ -85,7 +85,7 @@ pub trait UniqueRefPathGenerator { /// pub trait RefStore<'a> { - fn get_ref(&'a self, hash: &String) -> Result>, RPG::Error>; + fn get_ref>(&'a self, hash: H) -> Result>, RPG::Error>; fn create_ref>(&'a self, path: A) -> Result, RPG::Error>; fn retrieve_ref>(&'a self, path: A) -> Result, RPG::Error>; @@ -93,10 +93,10 @@ pub trait RefStore<'a> { impl<'a> RefStore<'a> for Store { - fn get_ref(&'a self, hash: &String) + fn get_ref>(&'a self, hash: H) -> Result>, RPG::Error> { - let sid = StoreId::new_baseless(PathBuf::from(format!("{}/{}", RPG::collection(), hash))) + let sid = StoreId::new_baseless(PathBuf::from(format!("{}/{}", RPG::collection(), hash.as_ref()))) .map_err(RE::from)?; debug!("Getting: {:?}", sid); @@ -131,7 +131,7 @@ impl<'a> RefStore<'a> for Store { fn retrieve_ref>(&'a self, path: A) -> Result, RPG::Error> { - match self.get_ref::(&RPG::unique_hash(path.as_ref())?)? { + match self.get_ref::(RPG::unique_hash(path.as_ref())?)? { Some(r) => Ok(r), None => self.create_ref::(path), }