diff --git a/src/structs/inspectdata.rs b/src/structs/inspectdata.rs index a73262f..81731de 100644 --- a/src/structs/inspectdata.rs +++ b/src/structs/inspectdata.rs @@ -1,26 +1,26 @@ use bollard::secret::{ImageInspect, ImageSummary}; pub trait InspectData { - fn tags(&self) -> Option>; - fn digests(&self) -> Option>; + fn tags(&self) -> Option<&Vec>; + fn digests(&self) -> Option<&Vec>; } impl InspectData for ImageInspect { - fn tags(&self) -> Option> { - self.repo_tags.clone() + fn tags(&self) -> Option<&Vec> { + self.repo_tags.as_ref() } - fn digests(&self) -> Option> { - self.repo_digests.clone() + fn digests(&self) -> Option<&Vec> { + self.repo_digests.as_ref() } } impl InspectData for ImageSummary { - fn tags(&self) -> Option> { - Some(self.repo_tags.clone()) + fn tags(&self) -> Option<&Vec> { + Some(&self.repo_tags) } - fn digests(&self) -> Option> { - Some(self.repo_digests.clone()) + fn digests(&self) -> Option<&Vec> { + Some(&self.repo_digests) } } diff --git a/src/utils/reference.rs b/src/utils/reference.rs index 4fdd7b3..435f949 100644 --- a/src/utils/reference.rs +++ b/src/utils/reference.rs @@ -14,12 +14,13 @@ pub fn split(reference: &str) -> (String, String, String) { Some(registry) => registry.as_str().to_owned(), None => String::from(DEFAULT_REGISTRY), }; + let is_default_registry = registry == DEFAULT_REGISTRY; return ( - registry.clone(), + registry, match c.name("repository") { Some(repository) => { let repo = repository.as_str().to_owned(); - if !repo.contains('/') && registry == DEFAULT_REGISTRY { + if !repo.contains('/') && is_default_registry { format!("library/{}", repo) } else { repo