Skip to content

Commit

Permalink
Move race feature from std to default
Browse files Browse the repository at this point in the history
This makes the race feature completely independent from the std feature.

Signed-off-by: John Nunley <dev@notgull.net>
  • Loading branch information
notgull committed Sep 2, 2023
1 parent 5189142 commit 7fa2c31
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ categories = ["asynchronous", "concurrency"]
exclude = ["/.*"]

[features]
default = ["std"]
std = ["alloc", "fastrand/std", "futures-io", "parking", "memchr", "race", "waker-fn"]
default = ["race", "std"]
std = ["alloc", "fastrand/std", "futures-io", "parking", "memchr", "waker-fn"]
alloc = []
race = ["fastrand"]

Expand Down
4 changes: 2 additions & 2 deletions src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ where
/// let res = future::race(ready(1), ready(2)).await;
/// # })
/// ```
#[cfg(feature = "std")]
#[cfg(all(feature = "race", feature = "std"))]
pub fn race<T, F1, F2>(future1: F1, future2: F2) -> Race<F1, F2>
where
F1: Future<Output = T>,
Expand Down Expand Up @@ -680,7 +680,7 @@ pub trait FutureExt: Future {
/// let res = ready(1).race(ready(2)).await;
/// # })
/// ```
#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "race"))]
fn race<F>(self, other: F) -> Race<Self, F>
where
Self: Sized,
Expand Down
4 changes: 2 additions & 2 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ pub trait StreamExt: Stream {
/// let res = once(1).race(once(2)).next().await;
/// # })
/// ```
#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "race"))]
fn race<S>(self, other: S) -> Race<Self, S>
where
Self: Sized,
Expand Down Expand Up @@ -2376,7 +2376,7 @@ where
/// let res = stream::race(once(1), once(2)).next().await;
/// # })
/// ```
#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "race"))]
pub fn race<T, S1, S2>(stream1: S1, stream2: S2) -> Race<S1, S2>
where
S1: Stream<Item = T>,
Expand Down

0 comments on commit 7fa2c31

Please sign in to comment.