From d0bf143a7cc04b088882cb95e510cc8cf57eab27 Mon Sep 17 00:00:00 2001 From: William Lyles <26171886+wilyle@users.noreply.github.com> Date: Fri, 16 Feb 2024 12:52:01 -0800 Subject: [PATCH] clippy --- .../src/in_memory_mock_digital_twin_adapter.rs | 2 +- .../src/chariott_service_discovery_adapter.rs | 2 +- .../src/file_service_discovery_adapter.rs | 2 +- common/src/service_discovery_adapter.rs | 2 +- common/src/service_discovery_adapter_selector.rs | 2 +- freyja/src/service_discovery_adapter_selector_impl.rs | 2 +- proc_macros/src/freyja_main/parse.rs | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/adapters/digital_twin/in_memory_mock_digital_twin_adapter/src/in_memory_mock_digital_twin_adapter.rs b/adapters/digital_twin/in_memory_mock_digital_twin_adapter/src/in_memory_mock_digital_twin_adapter.rs index 8a97741..12f8447 100644 --- a/adapters/digital_twin/in_memory_mock_digital_twin_adapter/src/in_memory_mock_digital_twin_adapter.rs +++ b/adapters/digital_twin/in_memory_mock_digital_twin_adapter/src/in_memory_mock_digital_twin_adapter.rs @@ -92,7 +92,7 @@ mod in_memory_mock_digital_twin_adapter_tests { impl ServiceDiscoveryAdapterSelector for ServiceDiscoveryAdapterSelectorImpl { fn register(&mut self, adapter: Box) -> Result<(), ServiceDiscoveryAdapterError>; - async fn get_service_uri(&self, id: &String) -> Result; + async fn get_service_uri<'a>(&self, id: &'a str) -> Result; } } diff --git a/adapters/service_discovery/chariott_service_discovery_adapter/src/chariott_service_discovery_adapter.rs b/adapters/service_discovery/chariott_service_discovery_adapter/src/chariott_service_discovery_adapter.rs index c2a07ed..6df1d73 100644 --- a/adapters/service_discovery/chariott_service_discovery_adapter/src/chariott_service_discovery_adapter.rs +++ b/adapters/service_discovery/chariott_service_discovery_adapter/src/chariott_service_discovery_adapter.rs @@ -68,7 +68,7 @@ impl ServiceDiscoveryAdapter for ChariottServiceDiscoveryAdapter { /// /// # Arguments /// - `id`: the service identifier - async fn get_service_uri(&self, id: &String) -> Result { + async fn get_service_uri<'a>(&self, id: &'a str) -> Result { let pieces = id.split('/').collect::>(); if pieces.len() != 3 { return Err(ServiceDiscoveryAdapterErrorKind::InvalidId.into()); diff --git a/adapters/service_discovery/file_service_discovery_adapter/src/file_service_discovery_adapter.rs b/adapters/service_discovery/file_service_discovery_adapter/src/file_service_discovery_adapter.rs index cd46512..25b02d0 100644 --- a/adapters/service_discovery/file_service_discovery_adapter/src/file_service_discovery_adapter.rs +++ b/adapters/service_discovery/file_service_discovery_adapter/src/file_service_discovery_adapter.rs @@ -43,7 +43,7 @@ impl ServiceDiscoveryAdapter for FileServiceDiscoveryAdapter { /// /// # Arguments /// - `id`: the service identifier - async fn get_service_uri(&self, id: &String) -> Result { + async fn get_service_uri<'a>(&self, id: &'a str) -> Result { self.config .services .get(id) diff --git a/common/src/service_discovery_adapter.rs b/common/src/service_discovery_adapter.rs index 5ca4cc3..e2ab000 100644 --- a/common/src/service_discovery_adapter.rs +++ b/common/src/service_discovery_adapter.rs @@ -19,7 +19,7 @@ pub trait ServiceDiscoveryAdapter { /// /// # Arguments /// - `id`: the service identifier - async fn get_service_uri(&self, id: &String) -> Result; + async fn get_service_uri<'a>(&self, id: &'a str) -> Result; } proc_macros::error! { diff --git a/common/src/service_discovery_adapter_selector.rs b/common/src/service_discovery_adapter_selector.rs index f17f37f..dec139b 100644 --- a/common/src/service_discovery_adapter_selector.rs +++ b/common/src/service_discovery_adapter_selector.rs @@ -22,5 +22,5 @@ pub trait ServiceDiscoveryAdapterSelector { /// /// # Arguments /// - `id`: the service identifier - async fn get_service_uri(&self, id: &String) -> Result; + async fn get_service_uri<'a>(&self, id: &'a str) -> Result; } diff --git a/freyja/src/service_discovery_adapter_selector_impl.rs b/freyja/src/service_discovery_adapter_selector_impl.rs index 0625c17..4a72f29 100644 --- a/freyja/src/service_discovery_adapter_selector_impl.rs +++ b/freyja/src/service_discovery_adapter_selector_impl.rs @@ -46,7 +46,7 @@ impl ServiceDiscoveryAdapterSelector for ServiceDiscoveryAdapterSelectorImpl { /// /// # Arguments /// - `id`: the service identifier - async fn get_service_uri(&self, id: &String) -> Result { + async fn get_service_uri<'a>(&self, id: &'a str) -> Result { for adapter in self.adapters.iter() { log::debug!( "Attempting to discover uri for service {id} from adapter {}...", diff --git a/proc_macros/src/freyja_main/parse.rs b/proc_macros/src/freyja_main/parse.rs index 26f474b..b947978 100644 --- a/proc_macros/src/freyja_main/parse.rs +++ b/proc_macros/src/freyja_main/parse.rs @@ -117,7 +117,7 @@ mod freyja_main_parse_tests { output.service_discovery_adapter_types.len(), service_discovery_idents.len() ); - for i in 0..service_discovery_idents.len() { + for (i, _) in service_discovery_idents.iter().enumerate() { assert_eq!( output.service_discovery_adapter_types[i], service_discovery_idents[i] @@ -142,7 +142,7 @@ mod freyja_main_parse_tests { factory_idents.len() ); - for i in 0..factory_idents.len() { + for (i, _) in factory_idents.iter().enumerate() { assert_eq!(output.service_discovery_adapter_types[i], factory_idents[i]); } }