diff --git a/Cargo.toml b/Cargo.toml index 9bd4cbe..2efd86b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" keywords = ["async", "concurrency"] categories = ["asynchronous", "concurrency"] authors = ["Yoshua Wuyts "] -rust-version = "1.75.0" +rust-version = "1.81.0" [profile.bench] debug = true @@ -43,14 +43,14 @@ futures-buffered = "0.2.9" [dev-dependencies] async-io = "2.4" async-std = { version = "1.13.0", features = ["attributes"] } -criterion = { version = "0.5", features = [ +criterion = { version = "0.6", features = [ "async", "async_futures", "html_reports", ] } futures = "0.3" futures-time = "3.0.0" -itertools = "0.13" +itertools = "0.14" lending-stream = "1.0.1" -rand = "0.8.5" +rand = "0.9.1" tokio = { version = "1.41", features = ["macros", "time", "rt-multi-thread"] } diff --git a/benches/bench.rs b/benches/bench.rs index bf335e8..2de7e52 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -19,10 +19,11 @@ fn main() { mod stream_group { use criterion::async_executor::FuturesExecutor; - use criterion::{black_box, criterion_group, BatchSize, BenchmarkId, Criterion}; + use criterion::{criterion_group, BatchSize, BenchmarkId, Criterion}; use futures::stream::SelectAll; use futures_concurrency::stream::StreamGroup; use futures_lite::prelude::*; + use std::hint::black_box; use crate::utils::{make_select_all, make_stream_group}; criterion_group! { @@ -69,10 +70,11 @@ mod stream_group { } mod future_group { use std::fmt::{Debug, Display}; + use std::hint::black_box; use std::time::{Duration, Instant}; use criterion::async_executor::FuturesExecutor; - use criterion::{black_box, criterion_group, BatchSize, BenchmarkId, Criterion}; + use criterion::{criterion_group, BatchSize, BenchmarkId, Criterion}; use futures::channel::oneshot; use futures::never::Never; use futures::stream::FuturesUnordered; @@ -237,10 +239,11 @@ mod future_group { mod merge { use criterion::async_executor::FuturesExecutor; - use criterion::{black_box, criterion_group, Criterion}; + use criterion::{criterion_group, Criterion}; use futures_concurrency::prelude::*; use futures_lite::future::block_on; use futures_lite::prelude::*; + use std::hint::black_box; use super::utils::{streams_array, streams_tuple, streams_vec}; @@ -321,8 +324,9 @@ mod merge { mod join { use criterion::async_executor::FuturesExecutor; - use criterion::{black_box, criterion_group, Criterion}; + use criterion::{criterion_group, Criterion}; use futures_concurrency::prelude::*; + use std::hint::black_box; use super::utils::{futures_array, futures_tuple, futures_vec}; @@ -386,8 +390,9 @@ mod join { mod race { use criterion::async_executor::FuturesExecutor; - use criterion::{black_box, criterion_group, Criterion}; + use criterion::{criterion_group, Criterion}; use futures_concurrency::prelude::*; + use std::hint::black_box; use crate::utils::futures_tuple; diff --git a/src/concurrent_stream/from_stream.rs b/src/concurrent_stream/from_stream.rs index 38f7341..689008a 100644 --- a/src/concurrent_stream/from_stream.rs +++ b/src/concurrent_stream/from_stream.rs @@ -28,7 +28,7 @@ where type Item = S::Item; type Future = Ready; - async fn drive(self, mut consumer: C) -> C::Output + async fn drive(self, consumer: C) -> C::Output where C: Consumer, { diff --git a/src/future/join/tuple.rs b/src/future/join/tuple.rs index 0d01995..f680bf8 100644 --- a/src/future/join/tuple.rs +++ b/src/future/join/tuple.rs @@ -246,7 +246,7 @@ macro_rules! impl_join_tuple { fn drop(self: Pin<&mut Self>) { let this = self.project(); - let ($(ref mut $F,)+) = this.outputs; + let &mut ($(ref mut $F,)+) = this.outputs; let states = this.state; let mut futures = this.futures; diff --git a/src/future/mod.rs b/src/future/mod.rs index 23ef754..a5deac7 100644 --- a/src/future/mod.rs +++ b/src/future/mod.rs @@ -18,7 +18,7 @@ //! let b = future::ready(2); //! let c = future::ready(3); //! assert_eq!([a, b, c].join().await, [1, 2, 3]); -//! +//! //! // Await multiple differently-typed futures. //! let a = future::ready(1u8); //! let b = future::ready("hello"); @@ -66,7 +66,7 @@ //! //! - `future::TryMerge`: wait for all futures in the set to complete _successfully_, or return on the first error. //! - `future::RaceOk`: wait for the first _successful_ future in the set to -//! complete, or return an `Err` if *no* futures complete successfully. +//! complete, or return an `Err` if *no* futures complete successfully. //! #[doc(inline)] #[cfg(feature = "alloc")] diff --git a/src/future/try_join/tuple.rs b/src/future/try_join/tuple.rs index 8cf1152..ab3b1aa 100644 --- a/src/future/try_join/tuple.rs +++ b/src/future/try_join/tuple.rs @@ -280,7 +280,7 @@ macro_rules! impl_try_join_tuple { fn drop(self: Pin<&mut Self>) { let this = self.project(); - let ($(ref mut $F,)+) = this.outputs; + let &mut ($(ref mut $F,)+) = this.outputs; let states = this.state; let mut futures = this.futures; diff --git a/src/utils/poll_state/maybe_done.rs b/src/utils/poll_state/maybe_done.rs index c9bca17..a6e56a3 100644 --- a/src/utils/poll_state/maybe_done.rs +++ b/src/utils/poll_state/maybe_done.rs @@ -37,10 +37,9 @@ where MaybeDone::Done(Ok(_)) => {} MaybeDone::Done(Err(_)) | MaybeDone::Future(_) | MaybeDone::Gone => return None, } - if let MaybeDone::Done(Ok(output)) = mem::replace(this, MaybeDone::Gone) { - Some(output) - } else { - unreachable!() + match mem::replace(this, MaybeDone::Gone) { + MaybeDone::Done(Ok(output)) => Some(output), + _ => unreachable!(), } } @@ -53,10 +52,9 @@ where MaybeDone::Done(Err(_)) => {} MaybeDone::Done(Ok(_)) | MaybeDone::Future(_) | MaybeDone::Gone => return None, } - if let MaybeDone::Done(Err(output)) = mem::replace(this, MaybeDone::Gone) { - Some(output) - } else { - unreachable!() + match mem::replace(this, MaybeDone::Gone) { + MaybeDone::Done(Err(output)) => Some(output), + _ => unreachable!(), } } }