From cb1a1c24b70ee9bb0045c74873f915c495cbdc89 Mon Sep 17 00:00:00 2001 From: Thomas Eppers Date: Mon, 1 Nov 2021 12:34:05 +0100 Subject: [PATCH] fixed some clippy warnings; added TODOs for later --- src/repository/dockerhub.rs | 4 ++-- src/repository/mod.rs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/repository/dockerhub.rs b/src/repository/dockerhub.rs index e1fe087..a3202e0 100644 --- a/src/repository/dockerhub.rs +++ b/src/repository/dockerhub.rs @@ -27,7 +27,7 @@ impl Images { .iter() .map(|d| super::TagDetails { arch: Some(d.architecture.clone()), - size: Some(d.size.clone()), + size: Some(d.size), }) .collect(), } @@ -43,7 +43,7 @@ pub struct DockerHub { impl DockerHub { /// fetches tag information with a repository name in the form of organization/repository or library/repository in the case of official images from docker - pub fn new(repo: &str) -> Result { + pub fn create_repo(repo: &str) -> Result { let request = format!("https://hub.docker.com/v2/repositories/{}/tags", repo); Self::with_url(&request) } diff --git a/src/repository/mod.rs b/src/repository/mod.rs index 91c182f..0346128 100644 --- a/src/repository/mod.rs +++ b/src/repository/mod.rs @@ -73,7 +73,7 @@ impl Tag { let now = chrono::Utc::now(); let rfc3339 = DateTime::parse_from_rfc3339(last_updated).unwrap(); let dif = now - rfc3339.with_timezone(&chrono::Utc); - format!("{}", format_time_nice(dif)) + format_time_nice(dif) } }; format!("{} vor {} [{}]", self.name, dif, arch) @@ -96,13 +96,14 @@ impl Repo { Err(e) => return Err(Error::Converting(format!("{}", e))), }; + //TODO change according to registry // if ®istry == "ghcr.io" { // // // } else { // dockerhub::DockerHub::new(repo) // } - dockerhub::DockerHub::new(&repo) + dockerhub::DockerHub::create_repo(&repo) } pub fn with_url(url: &str) -> Result {