Skip to content

Commit

Permalink
utils: remove unzip_option
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
piodul authored and piodul committed Sep 11, 2023
1 parent 8d41e5b commit 8a9adce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
3 changes: 1 addition & 2 deletions scylla/src/transport/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions scylla/src/transport/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 0 additions & 8 deletions scylla/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, U>(opt: Option<(T, U)>) -> (Option<T>, Option<U>) {
match opt {
Some((a, b)) => (Some(a), Some(b)),
None => (None, None),
}
}

0 comments on commit 8a9adce

Please sign in to comment.