From 0cd6658a5d830093e1a3711456e8238564a5f204 Mon Sep 17 00:00:00 2001 From: Alex Snaps Date: Fri, 29 Nov 2024 04:30:21 -0500 Subject: [PATCH] Newer clippy lints Signed-off-by: Alex Snaps --- limitador-server/src/config.rs | 4 ++-- limitador-server/src/main.rs | 2 +- limitador/src/storage/distributed/grpc/mod.rs | 2 +- limitador/tests/integration_tests.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/limitador-server/src/config.rs b/limitador-server/src/config.rs index 9b351a2b..bf51cff4 100644 --- a/limitador-server/src/config.rs +++ b/limitador-server/src/config.rs @@ -20,7 +20,7 @@ use tracing::level_filters::LevelFilter; use url::Url; pub fn redacted_url(url: String) -> String { - return match Url::parse(url.as_str()) { + match Url::parse(url.as_str()) { Ok(url_object) => { if url_object.password().is_some() { let mut owned_url = url_object.clone(); @@ -34,7 +34,7 @@ pub fn redacted_url(url: String) -> String { } } Err(_) => url.clone(), - }; + } } #[derive(Debug)] diff --git a/limitador-server/src/main.rs b/limitador-server/src/main.rs index 99193219..ec12e420 100644 --- a/limitador-server/src/main.rs +++ b/limitador-server/src/main.rs @@ -752,7 +752,7 @@ fn guess_cache_size() -> Option { } fn leak(s: D) -> &'static str { - return Box::leak(format!("{}", s).into_boxed_str()); + Box::leak(format!("{}", s).into_boxed_str()) } fn configure_tracing_subscriber(config: &Configuration) { diff --git a/limitador/src/storage/distributed/grpc/mod.rs b/limitador/src/storage/distributed/grpc/mod.rs index b694b94f..b3a7ef4a 100644 --- a/limitador/src/storage/distributed/grpc/mod.rs +++ b/limitador/src/storage/distributed/grpc/mod.rs @@ -414,7 +414,7 @@ enum MessagePermit<'a> { Server(Permit<'a, Result>), Client(Permit<'a, Packet>), } -impl<'a> MessagePermit<'a> { +impl MessagePermit<'_> { fn send(self, message: Result) -> Result<(), Status> { match self { MessagePermit::Server(sender) => { diff --git a/limitador/tests/integration_tests.rs b/limitador/tests/integration_tests.rs index 8c475df4..be458d22 100644 --- a/limitador/tests/integration_tests.rs +++ b/limitador/tests/integration_tests.rs @@ -84,7 +84,7 @@ async fn distributed_storage_factory( let addresses = (0..count) .map(|i| format!("127.0.0.1:{}", 5200 + i)) .collect::>(); - return (0..count) + (0..count) .map(|i| { let node = format!("n{}", i); let listen_address = addresses.get(i).unwrap().to_owned(); @@ -97,7 +97,7 @@ async fn distributed_storage_factory( CrInMemoryStorage::new(node, 10_000, listen_address, peer_urls), ))) }) - .collect::>(); + .collect::>() } macro_rules! test_with_distributed_storage_impls {