Skip to content

Commit 683e77e

Browse files
committed
Remove Never type alias
1 parent f71d3f7 commit 683e77e

File tree

8 files changed

+17
-37
lines changed

8 files changed

+17
-37
lines changed

futures-sink/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ where
158158
#[cfg(feature = "alloc")]
159159
mod if_alloc {
160160
use super::*;
161-
use core::convert::Infallible as Never;
161+
use core::convert::Infallible;
162162

163163
impl<T> Sink<T> for alloc::vec::Vec<T> {
164-
type Error = Never;
164+
type Error = Infallible;
165165

166166
fn poll_ready(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
167167
Poll::Ready(Ok(()))
@@ -183,7 +183,7 @@ mod if_alloc {
183183
}
184184

185185
impl<T> Sink<T> for alloc::collections::VecDeque<T> {
186-
type Error = Never;
186+
type Error = Infallible;
187187

188188
fn poll_ready(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
189189
Poll::Ready(Ok(()))

futures-util/src/future/future/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#[cfg(feature = "alloc")]
77
use alloc::boxed::Box;
88
use core::pin::Pin;
9+
use core::convert::Infallible;
910

1011
use crate::fns::{inspect_fn, into_fn, ok_fn, InspectFn, IntoFn, OkFn};
1112
use crate::future::{assert_future, Either};
12-
use crate::never::Never;
1313
use crate::stream::assert_stream;
1414
#[cfg(feature = "alloc")]
1515
use futures_core::future::{BoxFuture, LocalBoxFuture};
@@ -83,7 +83,7 @@ delegate_all!(
8383
delegate_all!(
8484
/// Future for the [`never_error`](super::FutureExt::never_error) combinator.
8585
NeverError<Fut>(
86-
Map<Fut, OkFn<Never>>
86+
Map<Fut, OkFn<Infallible>>
8787
): Debug + Future + FusedFuture + New[|x: Fut| Map::new(x, ok_fn())]
8888
);
8989

@@ -551,7 +551,7 @@ pub trait FutureExt: Future {
551551
where
552552
Self: Sized,
553553
{
554-
assert_future::<Result<Self::Output, Never>, _>(NeverError::new(self))
554+
assert_future::<Result<Self::Output, Infallible>, _>(NeverError::new(self))
555555
}
556556

557557
/// A convenience for calling `Future::poll` on `Unpin` future types.

futures-util/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,6 @@ pub use crate::sink::SinkExt;
324324

325325
pub mod task;
326326

327-
pub mod never;
328-
329327
#[cfg(feature = "compat")]
330328
#[cfg_attr(docsrs, doc(cfg(feature = "compat")))]
331329
pub mod compat;

futures-util/src/never.rs

-18
This file was deleted.

futures-util/src/sink/drain.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::assert_sink;
2-
use crate::never::Never;
2+
use core::convert::Infallible;
33
use core::marker::PhantomData;
44
use core::pin::Pin;
55
use futures_core::task::{Context, Poll};
@@ -24,16 +24,16 @@ pub struct Drain<T> {
2424
///
2525
/// let mut drain = sink::drain();
2626
/// drain.send(5).await?;
27-
/// # Ok::<(), futures::never::Never>(()) }).unwrap();
27+
/// # Ok::<(), std::convert::Infallible>(()) }).unwrap();
2828
/// ```
2929
pub fn drain<T>() -> Drain<T> {
30-
assert_sink::<T, Never, _>(Drain { marker: PhantomData })
30+
assert_sink::<T, Infallible, _>(Drain { marker: PhantomData })
3131
}
3232

3333
impl<T> Unpin for Drain<T> {}
3434

3535
impl<T> Sink<T> for Drain<T> {
36-
type Error = Never;
36+
type Error = Infallible;
3737

3838
fn poll_ready(
3939
self: Pin<&mut Self>,

futures-util/src/sink/unfold.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ pin_project! {
2929
/// async move {
3030
/// sum += i;
3131
/// eprintln!("{}", i);
32-
/// Ok::<_, futures::never::Never>(sum)
32+
/// Ok::<_, std::convert::Infallible>(sum)
3333
/// }
3434
/// });
3535
/// futures::pin_mut!(unfold);
3636
/// unfold.send(5).await?;
37-
/// # Ok::<(), futures::never::Never>(()) }).unwrap();
37+
/// # Ok::<(), std::convert::Infallible>(()) }).unwrap();
3838
/// ```
3939
pub fn unfold<T, F, R, Item, E>(init: T, function: F) -> Unfold<T, F, R>
4040
where

futures/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub use futures_util::{join, pending, poll, select_biased, try_join}; // Async-a
133133

134134
// Module reexports
135135
#[doc(inline)]
136-
pub use futures_util::{future, never, sink, stream, task};
136+
pub use futures_util::{future, sink, stream, task};
137137

138138
#[cfg(feature = "alloc")]
139139
#[doc(inline)]

futures/tests/sink.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::convert::Infallible;
2+
13
mod sassert_next {
24
use futures::stream::{Stream, StreamExt};
35
use futures::task::Poll;
@@ -356,7 +358,6 @@ fn with_flush() {
356358
use futures::channel::oneshot;
357359
use futures::executor::block_on;
358360
use futures::future::{self, FutureExt, TryFutureExt};
359-
use futures::never::Never;
360361
use futures::sink::{Sink, SinkExt};
361362
use std::mem;
362363
use std::pin::Pin;
@@ -369,7 +370,7 @@ fn with_flush() {
369370
let mut sink = Vec::new().with(|elem| {
370371
mem::replace(&mut block, future::ok(()).boxed())
371372
.map_ok(move |()| elem + 1)
372-
.map_err(|_| -> Never { panic!() })
373+
.map_err(|_| -> Infallible { panic!() })
373374
});
374375

375376
assert_eq!(Pin::new(&mut sink).start_send(0).ok(), Some(()));
@@ -392,10 +393,9 @@ fn with_flush() {
392393
fn with_as_map() {
393394
use futures::executor::block_on;
394395
use futures::future;
395-
use futures::never::Never;
396396
use futures::sink::SinkExt;
397397

398-
let mut sink = Vec::new().with(|item| future::ok::<i32, Never>(item * 2));
398+
let mut sink = Vec::new().with(|item| future::ok::<i32, Infallible>(item * 2));
399399
block_on(sink.send(0)).unwrap();
400400
block_on(sink.send(1)).unwrap();
401401
block_on(sink.send(2)).unwrap();

0 commit comments

Comments
 (0)