chore: replace Never with Infallible (#612)

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
Folyd 2022-03-09 01:13:16 +08:00 committed by GitHub
parent 0e907963c3
commit 4bcfaeb33e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 40 deletions

View File

@ -1,12 +0,0 @@
use std::{error::Error, fmt};
#[derive(Debug)]
pub enum Never {}
impl fmt::Display for Never {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}
impl Error for Never {}

View File

@ -1,6 +1,7 @@
use super::{error::Never, Change};
use super::Change;
use futures_core::Stream;
use pin_project_lite::pin_project;
use std::convert::Infallible;
use std::iter::{Enumerate, IntoIterator};
use std::{
pin::Pin,
@ -41,7 +42,7 @@ impl<T, U> Stream for ServiceList<T>
where
T: IntoIterator<Item = U>,
{
type Item = Result<Change<usize, U>, Never>;
type Item = Result<Change<usize, U>, Infallible>;
fn poll_next(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<Self::Item>> {
match self.project().inner.next() {

View File

@ -33,7 +33,6 @@
//!
//! [`TryStream`]: https://docs.rs/futures/latest/futures/stream/trait.TryStream.html
mod error;
mod list;
pub use self::list::ServiceList;

View File

@ -1,12 +0,0 @@
use std::fmt;
#[derive(Debug)]
/// An error that can never occur.
pub enum Never {}
impl fmt::Display for Never {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}
impl std::error::Error for Never {}

View File

@ -1,13 +0,0 @@
use std::fmt;
#[derive(Debug)]
/// An error that can never occur.
pub enum Never {}
impl fmt::Display for Never {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}
impl std::error::Error for Never {}