mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-17 09:33:38 -05:00
Clippy
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use futures::future::join_all;
|
use futures::future::join_all;
|
||||||
use rustc_hash::FxHashMap;
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
use rustc_hash::FxHashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::Config,
|
config::Config,
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ pub async fn get_latest_tag(
|
|||||||
let mut next_url = Some(url);
|
let mut next_url = Some(url);
|
||||||
|
|
||||||
while next_url.is_some() {
|
while next_url.is_some() {
|
||||||
|
#[allow(unused_assignments)]
|
||||||
let mut new_tags = Vec::new();
|
let mut new_tags = Vec::new();
|
||||||
(new_tags, next_url) =
|
(new_tags, next_url) =
|
||||||
match get_extra_tags(&next_url.unwrap(), headers.clone(), base, client).await {
|
match get_extra_tags(&next_url.unwrap(), headers.clone(), base, client).await {
|
||||||
@@ -143,9 +144,7 @@ pub async fn get_latest_tag(
|
|||||||
};
|
};
|
||||||
tags.append(&mut new_tags);
|
tags.append(&mut new_tags);
|
||||||
}
|
}
|
||||||
let tag = tags
|
let tag = tags.iter().max();
|
||||||
.iter()
|
|
||||||
.max();
|
|
||||||
let current_tag = match &image.version_info {
|
let current_tag = match &image.version_info {
|
||||||
Some(data) => data.current_tag.clone(),
|
Some(data) => data.current_tag.clone(),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@@ -189,14 +188,14 @@ pub async fn get_extra_tags(
|
|||||||
base: &Version,
|
base: &Version,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
) -> Result<(Vec<Version>, Option<String>), String> {
|
) -> Result<(Vec<Version>, Option<String>), String> {
|
||||||
let response = client.get(&url, headers, false).await;
|
let response = client.get(url, headers, false).await;
|
||||||
|
|
||||||
match response {
|
match response {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
let next_url = match res.headers().get("Link") {
|
let next_url = res
|
||||||
Some(link) => Some(parse_link(link.to_str().unwrap(), &url)),
|
.headers()
|
||||||
None => None,
|
.get("Link")
|
||||||
};
|
.map(|link| parse_link(link.to_str().unwrap(), url));
|
||||||
let response_json = parse_json(&get_response_body(res).await);
|
let response_json = parse_json(&get_response_body(res).await);
|
||||||
let result = response_json["tags"]
|
let result = response_json["tags"]
|
||||||
.members()
|
.members()
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ use crate::error;
|
|||||||
pub fn parse_link(link: &str, base: &str) -> String {
|
pub fn parse_link(link: &str, base: &str) -> String {
|
||||||
match parse_link_header(link, &Url::from_str(base).unwrap()) {
|
match parse_link_header(link, &Url::from_str(base).unwrap()) {
|
||||||
Ok(l) => l[0].target.to_string(),
|
Ok(l) => l[0].target.to_string(),
|
||||||
Err(e) => error!("Failed to parse link! {}", e)
|
Err(e) => error!("Failed to parse link! {}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
pub mod json;
|
pub mod json;
|
||||||
|
pub mod link;
|
||||||
pub mod logging;
|
pub mod logging;
|
||||||
pub mod misc;
|
pub mod misc;
|
||||||
pub mod reference;
|
pub mod reference;
|
||||||
pub mod request;
|
pub mod request;
|
||||||
pub mod sort_update_vec;
|
pub mod sort_update_vec;
|
||||||
pub mod link;
|
|
||||||
Reference in New Issue
Block a user