Skip to content

Commit

Permalink
Remove IntoFuture
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Barber committed Jul 19, 2023
1 parent 75e53ff commit 4587897
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 77 deletions.
4 changes: 2 additions & 2 deletions futures-util/src/future/mod.rs
Expand Up @@ -40,8 +40,8 @@ pub use self::future::{Shared, WeakShared};

mod try_future;
pub use self::try_future::{
AndThen, ErrInto, InspectErr, InspectOk, IntoFuture, MapErr, MapOk, MapOkOrElse, OkInto,
OrElse, TryFlatten, TryFlattenStream, TryFutureExt, UnwrapOrElse,
AndThen, ErrInto, InspectErr, InspectOk, MapErr, MapOk, MapOkOrElse, OkInto, OrElse,
TryFlatten, TryFlattenStream, TryFutureExt, UnwrapOrElse,
};

#[cfg(feature = "sink")]
Expand Down
36 changes: 0 additions & 36 deletions futures-util/src/future/try_future/into_future.rs

This file was deleted.

32 changes: 0 additions & 32 deletions futures-util/src/future/try_future/mod.rs
Expand Up @@ -18,7 +18,6 @@ use crate::future::{assert_future, Inspect, Map};
use crate::stream::assert_stream;

// Combinators
mod into_future;
mod try_flatten;
mod try_flatten_err;

Expand Down Expand Up @@ -95,9 +94,6 @@ delegate_all!(
): Debug + Future + FusedFuture + New[|x: Fut, f: F| Inspect::new(x, inspect_err_fn(f))]
);

#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::into_future::IntoFuture;

delegate_all!(
/// Future for the [`map_ok`](TryFutureExt::map_ok) method.
MapOk<Fut, F>(
Expand Down Expand Up @@ -580,32 +576,4 @@ pub trait TryFutureExt: TryFuture {
{
Compat::new(self)
}

/// Wraps a [`TryFuture`] into a type that implements
/// [`Future`](std::future::Future).
///
/// [`TryFuture`]s currently do not implement the
/// [`Future`](std::future::Future) trait due to limitations of the
/// compiler.
///
/// # Examples
///
/// ```
/// use futures::future::{Future, TryFuture, TryFutureExt};
///
/// # type T = i32;
/// # type E = ();
/// fn make_try_future() -> impl TryFuture<Ok = T, Error = E> { // ... }
/// # async { Ok::<i32, ()>(1) }
/// # }
/// fn take_future(future: impl Future<Output = Result<T, E>>) { /* ... */ }
///
/// take_future(make_try_future().into_future());
/// ```
fn into_future(self) -> IntoFuture<Self>
where
Self: Sized,
{
assert_future::<Result<Self::Ok, Self::Error>, _>(IntoFuture::new(self))
}
}
7 changes: 0 additions & 7 deletions futures/tests/auto_traits.rs
Expand Up @@ -333,13 +333,6 @@ pub mod future {
assert_impl!(InspectOk<UnpinFuture, PhantomPinned>: Unpin);
assert_not_impl!(InspectOk<PhantomPinned, PhantomPinned>: Unpin);

assert_impl!(IntoFuture<SendFuture>: Send);
assert_not_impl!(IntoFuture<LocalFuture>: Send);
assert_impl!(IntoFuture<SyncFuture>: Sync);
assert_not_impl!(IntoFuture<LocalFuture>: Sync);
assert_impl!(IntoFuture<UnpinFuture>: Unpin);
assert_not_impl!(IntoFuture<PinnedFuture>: Unpin);

assert_impl!(IntoStream<SendFuture>: Send);
assert_not_impl!(IntoStream<LocalFuture>: Send);
assert_impl!(IntoStream<SyncFuture>: Sync);
Expand Down

0 comments on commit 4587897

Please sign in to comment.