From 23a9055199a3e7fb876177ecad8c99d4e57b2513 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 8 Jul 2024 16:10:18 +0000 Subject: [PATCH] relax and de-clutter let_underscore_must_use Signed-off-by: Jason Volk --- Cargo.toml | 1 - src/admin/mod.rs | 2 -- src/api/client/sync.rs | 11 +++-------- src/router/request.rs | 1 - src/router/run.rs | 1 - src/router/serve/unix.rs | 1 - src/service/admin/console.rs | 4 ---- src/service/mod.rs | 1 - src/service/services.rs | 12 ++---------- 9 files changed, 5 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dad0adeb..1ef39370 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -777,7 +777,6 @@ fn_to_numeric_cast_any = "warn" format_push_string = "warn" get_unwrap = "warn" impl_trait_in_params = "warn" -let_underscore_must_use = "warn" let_underscore_untyped = "warn" lossy_float_literal = "warn" mem_forget = "warn" diff --git a/src/admin/mod.rs b/src/admin/mod.rs index f2e35d80..6a47bc74 100644 --- a/src/admin/mod.rs +++ b/src/admin/mod.rs @@ -28,7 +28,6 @@ mod_ctor! {} mod_dtor! {} /// Install the admin command handler -#[allow(clippy::let_underscore_must_use)] pub async fn init() { _ = services() .admin @@ -45,7 +44,6 @@ pub async fn init() { } /// Uninstall the admin command handler -#[allow(clippy::let_underscore_must_use)] pub async fn fini() { _ = services().admin.handle.write().await.take(); _ = services() diff --git a/src/api/client/sync.rs b/src/api/client/sync.rs index 9ef1fab0..59813cb6 100644 --- a/src/api/client/sync.rs +++ b/src/api/client/sync.rs @@ -307,10 +307,7 @@ pub(crate) async fn sync_events_route( duration = Duration::from_secs(30); } - #[allow(clippy::let_underscore_must_use)] - { - _ = tokio::time::timeout(duration, watcher).await; - } + _ = tokio::time::timeout(duration, watcher).await; } Ok(response) @@ -1567,10 +1564,8 @@ pub(crate) async fn sync_events_v4_route( if duration.as_secs() > 30 { duration = Duration::from_secs(30); } - #[allow(clippy::let_underscore_must_use)] - { - _ = tokio::time::timeout(duration, watcher).await; - } + + _ = tokio::time::timeout(duration, watcher).await; } Ok(sync_events::v4::Response { diff --git a/src/router/request.rs b/src/router/request.rs index 49a31c29..079106ef 100644 --- a/src/router/request.rs +++ b/src/router/request.rs @@ -71,7 +71,6 @@ fn handle_result( } } -#[allow(clippy::unnecessary_wraps)] fn handle_result_403( _method: &Method, _uri: &Uri, result: &axum::response::Response, ) -> Result { diff --git a/src/router/run.rs b/src/router/run.rs index 4f7853d8..3e09823a 100644 --- a/src/router/run.rs +++ b/src/router/run.rs @@ -17,7 +17,6 @@ use crate::{layers, serve}; /// Main loop base #[tracing::instrument(skip_all)] -#[allow(clippy::let_underscore_must_use)] // various of these are intended pub(crate) async fn run(server: Arc) -> Result<(), Error> { let app = layers::build(&server)?; diff --git a/src/router/serve/unix.rs b/src/router/serve/unix.rs index 6c406d28..8373b749 100644 --- a/src/router/serve/unix.rs +++ b/src/router/serve/unix.rs @@ -54,7 +54,6 @@ pub(super) async fn serve(server: &Arc, app: Router, mut shutdown: broad Ok(()) } -#[allow(clippy::let_underscore_must_use)] async fn accept( server: &Arc, listener: &UnixListener, tasks: &mut JoinSet<()>, mut app: MakeService, builder: server::conn::auto::Builder, conn: (UnixStream, SocketAddr), diff --git a/src/service/admin/console.rs b/src/service/admin/console.rs index 0a200cae..27a4b6c7 100644 --- a/src/service/admin/console.rs +++ b/src/service/admin/console.rs @@ -45,7 +45,6 @@ impl Console { } } - #[allow(clippy::let_underscore_must_use)] pub async fn start(self: &Arc) { let mut worker_join = self.worker_join.lock().expect("locked"); if worker_join.is_none() { @@ -54,7 +53,6 @@ impl Console { } } - #[allow(clippy::let_underscore_must_use)] pub async fn close(self: &Arc) { self.interrupt(); let Some(worker_join) = self.worker_join.lock().expect("locked").take() else { @@ -113,7 +111,6 @@ impl Console { self.worker_join.lock().expect("locked").take(); } - #[allow(clippy::let_underscore_must_use)] async fn readline(self: &Arc) -> Result { let _suppression = log::Suppress::new(&services().server); @@ -138,7 +135,6 @@ impl Console { result } - #[allow(clippy::let_underscore_must_use)] async fn handle(self: Arc, line: String) { if line.trim().is_empty() { return; diff --git a/src/service/mod.rs b/src/service/mod.rs index 9c83b25c..4b19073d 100644 --- a/src/service/mod.rs +++ b/src/service/mod.rs @@ -37,7 +37,6 @@ conduit::mod_dtor! {} static SERVICES: RwLock> = RwLock::new(None); -#[allow(clippy::let_underscore_must_use)] pub async fn init(server: &Arc) -> Result<()> { let d = Arc::new(Database::open(server).await?); let s = Box::new(Services::build(server.clone(), d)?); diff --git a/src/service/services.rs b/src/service/services.rs index 0ba86693..aeed8204 100644 --- a/src/service/services.rs +++ b/src/service/services.rs @@ -132,11 +132,7 @@ impl Services { if self.globals.allow_check_for_updates() { let handle = globals::updates::start_check_for_updates_task(); - - #[allow(clippy::let_underscore_must_use)] // needed for shutdown - { - _ = self.globals.updates_handle.lock().await.insert(handle); - } + _ = self.globals.updates_handle.lock().await.insert(handle); } debug_info!("Services startup complete."); @@ -159,11 +155,7 @@ impl Services { debug!("Waiting for update worker..."); if let Some(updates_handle) = self.globals.updates_handle.lock().await.take() { updates_handle.abort(); - - #[allow(clippy::let_underscore_must_use)] - { - _ = updates_handle.await; - } + _ = updates_handle.await; } for (name, service) in &self.service {