From e06e8a182e599fea59bea7df10c895ddb53d7ee4 Mon Sep 17 00:00:00 2001 From: Peter Hayman Date: Thu, 3 Oct 2024 16:08:16 +1000 Subject: [PATCH] fix: remove async closures --- crates/forky_cli/src/lib.rs | 4 ++-- crates/forky_cli/src/server/proxy.rs | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/forky_cli/src/lib.rs b/crates/forky_cli/src/lib.rs index b73ce912..9ae7aafb 100644 --- a/crates/forky_cli/src/lib.rs +++ b/crates/forky_cli/src/lib.rs @@ -1,10 +1,10 @@ // #![feature(never_type, never_type_fallback)] -#![feature(async_closure, let_chains)] +#![feature(let_chains)] pub mod auto_mod; pub mod common; +pub mod key; pub mod server; pub mod style; -pub mod key; pub mod watch; pub mod prelude { diff --git a/crates/forky_cli/src/server/proxy.rs b/crates/forky_cli/src/server/proxy.rs index bde90281..4d49cbe4 100644 --- a/crates/forky_cli/src/server/proxy.rs +++ b/crates/forky_cli/src/server/proxy.rs @@ -98,7 +98,9 @@ impl Proxy { } pub async fn handle(&self, req: Request) -> Response { - (async || -> Result> { + // (async || -> Result> { + + let result: Result> = async { let uri = req.uri(); let uri = uri.remove_leading_slash()?; let proxied_referrer = referrer_is_proxied(&req); @@ -111,9 +113,10 @@ impl Proxy { // self.apply_next_origin(&uri)?; handle_proxy_request_from_url(req, &uri).await } - })() - .await - .to_response() + } + .await; + // })() + result.to_response() } fn apply_last_origin(&self, path: &str) -> Result {