From 8d41e5b5adf0b1303b8c411bc6b219391e615e44 Mon Sep 17 00:00:00 2001 From: Piotr Dulikowski Date: Mon, 11 Sep 2023 08:58:32 +0200 Subject: [PATCH 1/2] MSRV: bump to 1.66 One of our indirect dependencies (`toml_edit`) has updated its MSRV. As we do not keep Cargo.lock committed in the repo and cargo does not honor MSRV during crate resolution, we can just bump our current MSRV by one version forward, from 1.65.0 to 1.66.0. The version 1.66.0 is over 8 months old, so it's pretty old by the MSRV-breaking standards of the community. --- .github/workflows/rust.yml | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 86d7254a53..47ef3dc88c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,7 +10,7 @@ env: CARGO_TERM_COLOR: always RUSTFLAGS: -Dwarnings RUST_BACKTRACE: full - rust_min: 1.65.0 # <- Update this when bumping up MSRV + rust_min: 1.66.0 # <- Update this when bumping up MSRV jobs: build: diff --git a/README.md b/README.md index c9682925bb..a6d2f27bf1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # ScyllaDB Rust Driver [![Crates.io](https://img.shields.io/crates/v/scylla.svg)](https://crates.io/crates/scylla) [![docs.rs](https://docs.rs/scylla/badge.svg)](https://docs.rs/scylla) -[![minimum rustc version](https://img.shields.io/badge/rustc-1.65-orange.svg)](https://crates.io/crates/scylla) +[![minimum rustc version](https://img.shields.io/badge/rustc-1.66-orange.svg)](https://crates.io/crates/scylla) This is a client-side driver for [ScyllaDB] written in pure Rust with a fully async API using [Tokio]. Although optimized for ScyllaDB, the driver is also compatible with [Apache Cassandra®]. @@ -65,7 +65,7 @@ Ongoing efforts: Please join the `#rust-driver` channel on [ScyllaDB Slack] to discuss any issues or questions you might have. ## Supported Rust Versions -Our driver's minimum supported Rust version (MSRV) is 1.65.0. Any changes will be explicitly published and will only happen during major releases. +Our driver's minimum supported Rust version (MSRV) is 1.66.0. Any changes will be explicitly published and will only happen during major releases. ## Reference Documentation From 8a9adce0ea526fc83f2de5550c281268dd16d0de Mon Sep 17 00:00:00 2001 From: Piotr Dulikowski Date: Mon, 11 Sep 2023 09:03:57 +0200 Subject: [PATCH 2/2] utils: remove unzip_option `unzip_option` was a workaround for missing `Option::unzip()`, which was introduced in Rust v1.66.0. We finally bumped the MSRV to 1.66.0, so `unzip_option` can be removed and replaced with the real thing. --- scylla/src/transport/iterator.rs | 3 +-- scylla/src/transport/session.rs | 8 ++++---- scylla/src/utils/mod.rs | 8 -------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/scylla/src/transport/iterator.rs b/scylla/src/transport/iterator.rs index a9f5a7ec5b..e9389992ed 100644 --- a/scylla/src/transport/iterator.rs +++ b/scylla/src/transport/iterator.rs @@ -38,7 +38,6 @@ use crate::transport::load_balancing::{self, RoutingInfo}; use crate::transport::metrics::Metrics; use crate::transport::retry_policy::{QueryInfo, RetryDecision, RetrySession}; use crate::transport::{Node, NodeRef}; -use crate::utils::unzip_option; use tracing::{trace, trace_span, warn, Instrument}; use uuid::Uuid; @@ -246,7 +245,7 @@ impl RowIterator { prepared_ref.get_partitioner_name(), values_ref, ) { - Ok(res) => unzip_option(res), + Ok(res) => res.unzip(), Err(err) => { let (proof, _res) = ProvingSender::from(sender).send(Err(err)).await; return proof; diff --git a/scylla/src/transport/session.rs b/scylla/src/transport/session.rs index 790f840400..35ff25475f 100644 --- a/scylla/src/transport/session.rs +++ b/scylla/src/transport/session.rs @@ -7,7 +7,6 @@ use crate::cloud::CloudConfig; use crate::history; use crate::history::HistoryListener; use crate::utils::pretty::{CommaSeparatedDisplayer, CqlValueDisplayer}; -use crate::utils::unzip_option; use arc_swap::ArcSwapOption; use async_trait::async_trait; use bytes::Bytes; @@ -937,11 +936,12 @@ impl Session { let values_ref = &serialized_values; let paging_state_ref = &paging_state; - let (partition_key, token) = - unzip_option(prepared.extract_partition_key_and_calculate_token( + let (partition_key, token) = prepared + .extract_partition_key_and_calculate_token( prepared.get_partitioner_name(), &serialized_values, - )?); + )? + .unzip(); let execution_profile = prepared .get_execution_profile_handle() diff --git a/scylla/src/utils/mod.rs b/scylla/src/utils/mod.rs index 9399e33266..c83adbf7e7 100644 --- a/scylla/src/utils/mod.rs +++ b/scylla/src/utils/mod.rs @@ -2,11 +2,3 @@ pub(crate) mod parse; pub(crate) mod pretty; pub mod test_utils; - -// FIXME: replace this with `Option::unzip()` once MSRV is bumped to at least 1.66 -pub(crate) fn unzip_option(opt: Option<(T, U)>) -> (Option, Option) { - match opt { - Some((a, b)) => (Some(a), Some(b)), - None => (None, None), - } -}