m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-15 16:43:49 -05:00

Probably meaningless change of some Option<&String>s to Option<&str>s

This commit is contained in:
Sergio
2025-01-02 13:00:32 +02:00
parent 84609d5189
commit fe779c9c4e
6 changed files with 9 additions and 9 deletions

View File

@@ -73,7 +73,7 @@ pub async fn get_updates(references: &Option<Vec<String>>, config: &Config) -> V
let token = get_token(
image_map.get(registry).unwrap(),
&auth_url,
&credentials,
credentials,
&client,
)
.await;
@@ -107,7 +107,7 @@ pub async fn get_updates(references: &Option<Vec<String>>, config: &Config) -> V
let is_ignored = ignored_registries.contains(&&image.registry) || config.images.exclude.iter().any(|item| image.reference.starts_with(item));
if !is_ignored {
let token = tokens.get(image.registry.as_str()).unwrap();
let future = image.check(token.as_ref(), config, &client);
let future = image.check(token.as_deref(), config, &client);
handles.push(future);
}
}

View File

@@ -4,7 +4,7 @@ use futures::future::join_all;
use crate::{config::Config, error, structs::image::Image};
fn create_docker_client(socket: Option<&String>) -> Docker {
fn create_docker_client(socket: Option<&str>) -> Docker {
let client: Result<Docker, bollard::errors::Error> = match socket {
Some(sock) => {
if sock.starts_with("unix://") {
@@ -41,7 +41,7 @@ pub async fn get_images_from_docker_daemon(
config: &Config,
references: &Option<Vec<String>>,
) -> Vec<Image> {
let client: Docker = create_docker_client(config.socket.as_ref());
let client: Docker = create_docker_client(config.socket.as_deref());
match references {
Some(refs) => {
let mut inspect_handles = Vec::with_capacity(refs.len());

View File

@@ -43,7 +43,7 @@ pub async fn check_auth(registry: &str, config: &Config, client: &Client) -> Opt
pub async fn get_latest_digest(
image: &Image,
token: Option<&String>,
token: Option<&str>,
config: &Config,
client: &Client,
) -> Image {
@@ -119,7 +119,7 @@ pub async fn get_token(
pub async fn get_latest_tag(
image: &Image,
base: &Version,
token: Option<&String>,
token: Option<&str>,
config: &Config,
client: &Client,
) -> Image {

View File

@@ -33,7 +33,7 @@ const FAVICON_ICO: &[u8] = include_bytes!("static/favicon.ico");
const FAVICON_SVG: &[u8] = include_bytes!("static/favicon.svg");
const APPLE_TOUCH_ICON: &[u8] = include_bytes!("static/apple-touch-icon.png");
const SORT_ORDER: [&'static str; 8] = [
const SORT_ORDER: [&str; 8] = [
"monitored_images",
"updates_available",
"major_updates",

View File

@@ -183,7 +183,7 @@ impl Image {
}
/// Checks if the image has an update
pub async fn check(&self, token: Option<&String>, config: &Config, client: &Client) -> Self {
pub async fn check(&self, token: Option<&str>, config: &Config, client: &Client) -> Self {
match &self.version_info {
Some(data) => get_latest_tag(self, &data.current_tag, token, config, client).await,
None => match self.digest_info {

View File

@@ -40,7 +40,7 @@ pub fn get_protocol(
}
}
pub fn to_bearer_string(token: &Option<&String>) -> Option<String> {
pub fn to_bearer_string(token: &Option<&str>) -> Option<String> {
token.as_ref().map(|t| format!("Bearer {}", t))
}