fixed some clippy warnings; added TODOs for later

This commit is contained in:
Thomas Eppers 2021-11-01 12:34:05 +01:00
parent bc09317d4b
commit cb1a1c24b7
2 changed files with 5 additions and 4 deletions

View File

@ -27,7 +27,7 @@ impl Images {
.iter() .iter()
.map(|d| super::TagDetails { .map(|d| super::TagDetails {
arch: Some(d.architecture.clone()), arch: Some(d.architecture.clone()),
size: Some(d.size.clone()), size: Some(d.size),
}) })
.collect(), .collect(),
} }
@ -43,7 +43,7 @@ pub struct DockerHub {
impl 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 /// 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<super::Repo, Error> { pub fn create_repo(repo: &str) -> Result<super::Repo, Error> {
let request = format!("https://hub.docker.com/v2/repositories/{}/tags", repo); let request = format!("https://hub.docker.com/v2/repositories/{}/tags", repo);
Self::with_url(&request) Self::with_url(&request)
} }

View File

@ -73,7 +73,7 @@ impl Tag {
let now = chrono::Utc::now(); let now = chrono::Utc::now();
let rfc3339 = DateTime::parse_from_rfc3339(last_updated).unwrap(); let rfc3339 = DateTime::parse_from_rfc3339(last_updated).unwrap();
let dif = now - rfc3339.with_timezone(&chrono::Utc); let dif = now - rfc3339.with_timezone(&chrono::Utc);
format!("{}", format_time_nice(dif)) format_time_nice(dif)
} }
}; };
format!("{} vor {} [{}]", self.name, dif, arch) format!("{} vor {} [{}]", self.name, dif, arch)
@ -96,13 +96,14 @@ impl Repo {
Err(e) => return Err(Error::Converting(format!("{}", e))), Err(e) => return Err(Error::Converting(format!("{}", e))),
}; };
//TODO change according to registry
// if &registry == "ghcr.io" { // if &registry == "ghcr.io" {
// // // //
// } else { // } else {
// dockerhub::DockerHub::new(repo) // dockerhub::DockerHub::new(repo)
// } // }
dockerhub::DockerHub::new(&repo) dockerhub::DockerHub::create_repo(&repo)
} }
pub fn with_url(url: &str) -> Result<Self, Error> { pub fn with_url(url: &str) -> Result<Self, Error> {