From ae6995582a0859e7a5ad747d3beb53bb800679bf Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 22 Oct 2024 17:01:27 +0200 Subject: [PATCH] Upgrade to Rust 1.82.0 (#3407) --- .github/workflows/ci.yaml | 4 ++-- Dockerfile | 2 +- crates/handlers/src/admin/call_context.rs | 13 ++----------- crates/handlers/src/test_utils.rs | 10 ++-------- crates/listener/src/proxy_protocol/maybe.rs | 15 ++++++--------- 5 files changed, 13 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5a1d9fe80..eb7848ea7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -195,8 +195,8 @@ jobs: - name: Install toolchain run: | - rustup toolchain install 1.81.0 - rustup default 1.81.0 + rustup toolchain install 1.82.0 + rustup default 1.82.0 rustup component add clippy - name: Setup OPA diff --git a/Dockerfile b/Dockerfile index ccfe3c6aa..bec8f2903 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ # The Debian version and version name must be in sync ARG DEBIAN_VERSION=12 ARG DEBIAN_VERSION_NAME=bookworm -ARG RUSTC_VERSION=1.81.0 +ARG RUSTC_VERSION=1.82.0 ARG NODEJS_VERSION=20.15.0 ARG OPA_VERSION=0.64.1 ARG CARGO_AUDITABLE_VERSION=0.6.4 diff --git a/crates/handlers/src/admin/call_context.rs b/crates/handlers/src/admin/call_context.rs index 956395cce..a2c07bfcb 100644 --- a/crates/handlers/src/admin/call_context.rs +++ b/crates/handlers/src/admin/call_context.rs @@ -123,17 +123,8 @@ where parts: &mut axum::http::request::Parts, state: &S, ) -> Result { - let activity_tracker = BoundActivityTracker::from_request_parts(parts, state).await; - let activity_tracker = match activity_tracker { - Ok(t) => t, - Err(e) => match e {}, - }; - - let clock = BoxClock::from_request_parts(parts, state).await; - let clock = match clock { - Ok(c) => c, - Err(e) => match e {}, - }; + let Ok(activity_tracker) = BoundActivityTracker::from_request_parts(parts, state).await; + let Ok(clock) = BoxClock::from_request_parts(parts, state).await; // Load the database repository let mut repo = BoxRepository::from_request_parts(parts, state) diff --git a/crates/handlers/src/test_utils.rs b/crates/handlers/src/test_utils.rs index 40283a6ff..e54dd2fc4 100644 --- a/crates/handlers/src/test_utils.rs +++ b/crates/handlers/src/test_utils.rs @@ -264,14 +264,8 @@ impl TestState { .with_state(self.clone()) .into_service(); - // Both unwrap are on Infallible, so this is safe - let response = app - .ready_oneshot() - .await - .unwrap() - .call(request) - .await - .unwrap(); + let Ok(mut service) = app.ready_oneshot().await; + let Ok(response) = service.call(request).await; let (parts, body) = response.into_parts(); diff --git a/crates/listener/src/proxy_protocol/maybe.rs b/crates/listener/src/proxy_protocol/maybe.rs index e396c053a..7e7930686 100644 --- a/crates/listener/src/proxy_protocol/maybe.rs +++ b/crates/listener/src/proxy_protocol/maybe.rs @@ -55,15 +55,12 @@ impl MaybeProxyAcceptor { where T: AsyncRead + Unpin, { - match &self.acceptor { - Some(acceptor) => { - let (info, stream) = acceptor.accept(stream).await?; - Ok((Some(info), stream)) - } - None => { - let stream = Rewind::new(stream); - Ok((None, stream)) - } + if let Some(acceptor) = self.acceptor { + let (info, stream) = acceptor.accept(stream).await?; + Ok((Some(info), stream)) + } else { + let stream = Rewind::new(stream); + Ok((None, stream)) } } }