Skip to content

Commit 925b42b

Browse files
authored
Merge pull request #493 from stjepang/cleanup-future
Cleanup future module
2 parents 96d3560 + d4f38e7 commit 925b42b

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

src/future/future/delay.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use std::future::Future;
12
use std::pin::Pin;
23
use std::time::Duration;
3-
use std::future::Future;
44

55
use futures_timer::Delay;
66
use pin_project_lite::pin_project;
@@ -9,7 +9,7 @@ use crate::task::{Context, Poll};
99

1010
pin_project! {
1111
#[doc(hidden)]
12-
#[derive(Debug)]
12+
#[allow(missing_debug_implementations)]
1313
pub struct DelayFuture<F> {
1414
#[pin]
1515
future: F,

src/future/future/flatten.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
use std::pin::Pin;
21
use std::future::Future;
2+
use std::pin::Pin;
33

4-
use crate::future::{IntoFuture};
4+
use crate::future::IntoFuture;
55
use crate::task::{ready, Context, Poll};
66

7-
#[derive(Debug)]
7+
#[doc(hidden)]
8+
#[allow(missing_debug_implementations)]
89
pub struct FlattenFuture<Fut1, Fut2> {
910
state: State<Fut1, Fut2>,
1011
}

src/future/future/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ extension_trait! {
152152
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
153153
fn delay(self, dur: Duration) -> impl Future<Output = Self::Output> [DelayFuture<Self>]
154154
where
155-
Self: Future + Sized
155+
Self: Sized,
156156
{
157157
DelayFuture::new(self, dur)
158158
}
@@ -173,10 +173,13 @@ extension_trait! {
173173
/// ```
174174
#[cfg(feature = "unstable")]
175175
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
176-
fn flatten(self) -> impl Future<Output = <<Self as Future>::Output as IntoFuture>::Output> [FlattenFuture<Self, <<Self as Future>::Output as IntoFuture>::Future>]
176+
fn flatten(
177+
self,
178+
) -> impl Future<Output = <Self::Output as IntoFuture>::Output>
179+
[FlattenFuture<Self, <Self::Output as IntoFuture>::Future>]
177180
where
178-
Self: Future + Sized,
179-
<Self as Future>::Output: IntoFuture
181+
Self: Sized,
182+
<Self as Future>::Output: IntoFuture,
180183
{
181184
FlattenFuture::new(self)
182185
}
@@ -214,7 +217,7 @@ extension_trait! {
214217
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
215218
fn race<F>(
216219
self,
217-
other: F
220+
other: F,
218221
) -> impl Future<Output = <Self as std::future::Future>::Output> [Race<Self, F>]
219222
where
220223
Self: std::future::Future + Sized,
@@ -258,7 +261,7 @@ extension_trait! {
258261
"#]
259262
#[cfg(feature = "unstable")]
260263
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
261-
fn try_race<F: std::future::Future, T, E>(
264+
fn try_race<F, T, E>(
262265
self,
263266
other: F
264267
) -> impl Future<Output = <Self as std::future::Future>::Output> [TryRace<Self, F>]

src/future/future/race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
use std::future::Future;
12
use std::pin::Pin;
23

34
use async_macros::MaybeDone;
45
use pin_project_lite::pin_project;
56

67
use crate::task::{Context, Poll};
7-
use std::future::Future;
88

99
pin_project! {
1010
#[allow(missing_docs)]

src/future/into_future.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pub trait IntoFuture {
4545

4646
impl<T: Future> IntoFuture for T {
4747
type Output = T::Output;
48-
4948
type Future = T;
5049

5150
fn into_future(self) -> Self::Future {

src/future/pending.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use std::future::Future;
12
use std::marker::PhantomData;
23
use std::pin::Pin;
3-
use std::future::Future;
44

55
use crate::task::{Context, Poll};
66

0 commit comments

Comments
 (0)