Skip to content

fix: prepare for edition 2024 #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2021"
keywords = ["async", "concurrency"]
categories = ["asynchronous", "concurrency"]
authors = ["Yoshua Wuyts <yoshuawuyts@gmail.com>"]
rust-version = "1.75.0"
rust-version = "1.81.0"

[profile.bench]
debug = true
Expand Down Expand Up @@ -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"] }
15 changes: 10 additions & 5 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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};

Expand Down Expand Up @@ -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};

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/concurrent_stream/from_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ where
type Item = S::Item;
type Future = Ready<Self::Item>;

async fn drive<C>(self, mut consumer: C) -> C::Output
async fn drive<C>(self, consumer: C) -> C::Output
where
C: Consumer<Self::Item, Self::Future>,
{
Expand Down
2 changes: 1 addition & 1 deletion src/future/join/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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")]
Expand Down
2 changes: 1 addition & 1 deletion src/future/try_join/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 6 additions & 8 deletions src/utils/poll_state/maybe_done.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
}
}

Expand All @@ -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!(),
}
}
}
Expand Down
Loading