diff --git a/crates/teloxide/src/update_listeners/webhooks/axum.rs b/crates/teloxide/src/update_listeners/webhooks/axum.rs index 89f1cfb7..b925df5d 100644 --- a/crates/teloxide/src/update_listeners/webhooks/axum.rs +++ b/crates/teloxide/src/update_listeners/webhooks/axum.rs @@ -54,18 +54,12 @@ where tokio::spawn(async move { let tcp_listener = tokio::net::TcpListener::bind(address) .await - .map_err(|err| { - stop_token.stop(); - err - }) + .inspect_err(|_| stop_token.stop()) .expect("Couldn't bind to the address"); axum::serve(tcp_listener, app) .with_graceful_shutdown(stop_flag) .await - .map_err(|err| { - stop_token.stop(); - err - }) + .inspect_err(|_| stop_token.stop()) .expect("Axum server error"); }); diff --git a/crates/teloxide/src/utils/shutdown_token.rs b/crates/teloxide/src/utils/shutdown_token.rs index 14ca622f..f51cdd77 100644 --- a/crates/teloxide/src/utils/shutdown_token.rs +++ b/crates/teloxide/src/utils/shutdown_token.rs @@ -122,10 +122,7 @@ impl DispatcherState { .map(ShutdownState::from_u8) .map_err(ShutdownState::from_u8) // FIXME: `Result::inspect` when :( - .map(|st| { - self.notify.notify_waiters(); - st - }) + .inspect(|_| self.notify.notify_waiters()) } }