diff --git a/src/check.rs b/src/check.rs index 6aefcc0..b968c55 100644 --- a/src/check.rs +++ b/src/check.rs @@ -73,7 +73,7 @@ pub async fn get_updates(references: &Option>, 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>, 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); } } diff --git a/src/docker.rs b/src/docker.rs index af90896..b197629 100644 --- a/src/docker.rs +++ b/src/docker.rs @@ -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 = 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 { - 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()); diff --git a/src/registry.rs b/src/registry.rs index ea4286e..c3ae73b 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -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 { diff --git a/src/server.rs b/src/server.rs index 846fe3e..0e1aa84 100644 --- a/src/server.rs +++ b/src/server.rs @@ -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", diff --git a/src/structs/image.rs b/src/structs/image.rs index 8e9936e..1ceb5ef 100644 --- a/src/structs/image.rs +++ b/src/structs/image.rs @@ -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 { diff --git a/src/utils/request.rs b/src/utils/request.rs index 30c38d8..ad36521 100644 --- a/src/utils/request.rs +++ b/src/utils/request.rs @@ -40,7 +40,7 @@ pub fn get_protocol( } } -pub fn to_bearer_string(token: &Option<&String>) -> Option { +pub fn to_bearer_string(token: &Option<&str>) -> Option { token.as_ref().map(|t| format!("Bearer {}", t)) }