From 5fea61913eb39340d78339f1fded2086aca40836 Mon Sep 17 00:00:00 2001 From: Daniel Harvey Date: Wed, 18 Sep 2024 13:10:01 +0100 Subject: [PATCH] Update to Rust 1.81.0, fix clippy suggestions (#610) ### What Upgrade to Rust 1.81.0, fix clippy lint suggestions. ### How Update `rust-toolchain.yaml` --- crates/query-engine/execution/src/mutation.rs | 15 ++++------ crates/query-engine/execution/src/query.rs | 15 ++++------ flake.lock | 29 ++++++++----------- flake.nix | 1 - rust-toolchain.toml | 2 +- 5 files changed, 25 insertions(+), 37 deletions(-) diff --git a/crates/query-engine/execution/src/mutation.rs b/crates/query-engine/execution/src/mutation.rs index 302390278..654ac7b4c 100644 --- a/crates/query-engine/execution/src/mutation.rs +++ b/crates/query-engine/execution/src/mutation.rs @@ -30,9 +30,8 @@ pub async fn execute( .await; let mut connection = acquisition_timer .complete_with(connection_result) - .map_err(|err| { + .inspect_err(|_err| { metrics.error_metrics.record_connection_acquisition_error(); - err })?; let query_timer = metrics.time_query_execution(); @@ -195,13 +194,11 @@ pub async fn explain( internal.visibility = "user", )) .await; - let mut connection = - acquisition_timer - .complete_with(connection_result) - .map_err(|err| { - metrics.error_metrics.record_connection_acquisition_error(); - err - })?; + let mut connection = acquisition_timer + .complete_with(connection_result) + .inspect_err(|_err| { + metrics.error_metrics.record_connection_acquisition_error(); + })?; tracing::info!( generated_sql = query_sql.sql, diff --git a/crates/query-engine/execution/src/query.rs b/crates/query-engine/execution/src/query.rs index a3f27f9f9..ecf606120 100644 --- a/crates/query-engine/execution/src/query.rs +++ b/crates/query-engine/execution/src/query.rs @@ -33,9 +33,8 @@ pub async fn execute( .await; let mut connection = acquisition_timer .complete_with(connection_result) - .map_err(|err| { + .inspect_err(|_err| { metrics.error_metrics.record_connection_acquisition_error(); - err })?; let query_timer = metrics.time_query_execution(); @@ -83,13 +82,11 @@ pub async fn explain( internal.visibility = "user", )) .await; - let mut connection = - acquisition_timer - .complete_with(connection_result) - .map_err(|err| { - metrics.error_metrics.record_connection_acquisition_error(); - err - })?; + let mut connection = acquisition_timer + .complete_with(connection_result) + .inspect_err(|_err| { + metrics.error_metrics.record_connection_acquisition_error(); + })?; for statement in plan.pre { execute_statement(&mut connection, &statement).await?; diff --git a/flake.lock b/flake.lock index 3d82c05f3..5c941ce69 100644 --- a/flake.lock +++ b/flake.lock @@ -1,17 +1,12 @@ { "nodes": { "crane": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, "locked": { - "lastModified": 1724006180, - "narHash": "sha256-PVxPj0Ga2fMYMtcT9ARCthF+4U71YkOT7ZjgD/vf1Aw=", + "lastModified": 1725409566, + "narHash": "sha256-PrtLmqhM6UtJP7v7IGyzjBFhbG4eOAHT6LPYOFmYfbk=", "owner": "ipetkov", "repo": "crane", - "rev": "7ce92819802bc583b7e82ebc08013a530f22209f", + "rev": "7e4586bad4e3f8f97a9271def747cf58c4b68f3c", "type": "github" }, "original": { @@ -25,11 +20,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -40,11 +35,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1724273822, - "narHash": "sha256-n5qhX3XieaqLYoyxSuTcXMOBLIGN+t1HfB0mms+Q+eM=", + "lastModified": 1726585183, + "narHash": "sha256-bZZIY8qD5y+jEE8XeNzflvPlUpkOUlJ6RA4+wN7Xwfg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c1350d7b9d4b04131cf2979e77fec9bfa47213a4", + "rev": "45b95421fdaf52d38ad3c04ae29ad1de260bbcaf", "type": "github" }, "original": { @@ -68,11 +63,11 @@ ] }, "locked": { - "lastModified": 1724206841, - "narHash": "sha256-L8dKaX4T3k+TR2fEHCfGbH4UXdspovz/pj87iai9qmc=", + "lastModified": 1726539203, + "narHash": "sha256-u1tAteb4qkH2gGjDY3mN/4Qxa6y798t4G0jNKDyTwv8=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "45e98fbd62c32e5927e952d2833fa1ba4fb35a61", + "rev": "20c8461785d8f5af32d8d4d5c128589e23d7f033", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a80c6e4b1..8b3a03206 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,6 @@ crane = { url = "github:ipetkov/crane"; - inputs.nixpkgs.follows = "nixpkgs"; }; rust-overlay = { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e94f55ffc..1612f132d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.80.1" +channel = "1.81.0" profile = "default" # see https://rust-lang.github.io/rustup/concepts/profiles.html components = ["rust-analyzer", "rust-src"] # see https://rust-lang.github.io/rustup/concepts/components.html