Skip to content

Commit 03fb434

Browse files
Nemo157cramertj
authored andcommitted
Improve unit_error documentation
1 parent 6b94ad3 commit 03fb434

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

futures-util/src/future/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,8 @@ pub trait FutureExt: Future {
535535
Box::pin(self)
536536
}
537537

538-
/// Turns a `Future` into a `TryFuture` with `Error = ()`.
538+
/// Turns a [`Future<Output = T>`](Future) into a
539+
/// [`TryFuture<Ok = T, Error = ()`>](futures_core::future::TryFuture).
539540
fn unit_error(self) -> UnitError<Self>
540541
where Self: Sized
541542
{

futures-util/src/future/unit_error.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use futures_core::future::{FusedFuture, Future};
33
use futures_core::task::{Context, Poll};
44
use pin_utils::unsafe_pinned;
55

6-
/// Future for the `unit_error` combinator, turning a `Future` into a `TryFuture`.
7-
///
8-
/// This is created by the `FutureExt::unit_error` method.
6+
/// Future for the [`unit_error`](super::FutureExt::unit_error) combinator.
97
#[derive(Debug)]
108
#[must_use = "futures do nothing unless polled"]
119
pub struct UnitError<Fut> {
@@ -15,7 +13,6 @@ pub struct UnitError<Fut> {
1513
impl<Fut> UnitError<Fut> {
1614
unsafe_pinned!(future: Fut);
1715

18-
/// Creates a new UnitError.
1916
pub(super) fn new(future: Fut) -> UnitError<Fut> {
2017
UnitError { future }
2118
}

futures/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub mod future {
201201
OptionFuture,
202202

203203
FutureExt,
204-
FlattenStream, Flatten, Fuse, Inspect, IntoStream, Map, Then,
204+
FlattenStream, Flatten, Fuse, Inspect, IntoStream, Map, Then, UnitError,
205205
};
206206

207207
#[cfg(feature = "alloc")]

0 commit comments

Comments
 (0)