From 6eb91f04a8c368abe81eea3c4a085afbfa8893bd Mon Sep 17 00:00:00 2001 From: Waffle Date: Thu, 26 Dec 2019 21:50:39 +0300 Subject: [PATCH] Remove uses of `!` to be compatible with rust `<1.41` (in rust `>=1.41` `core::convert::Infallible = !` so with latest versions we will work just fine) --- Cargo.toml | 1 - .../dispatchers/filter/error_policy.rs | 22 +------------------ src/lib.rs | 1 - 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e18e2e8a..c2a044f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,4 +23,3 @@ serde_with_macros = "1.0.1" default = [] unstable-stream = [] # add streams to public API -never-type = [] # add never type (`!`) to punlic API diff --git a/src/dispatching/dispatchers/filter/error_policy.rs b/src/dispatching/dispatchers/filter/error_policy.rs index 18fa4620..a41ab17e 100644 --- a/src/dispatching/dispatchers/filter/error_policy.rs +++ b/src/dispatching/dispatchers/filter/error_policy.rs @@ -1,6 +1,4 @@ -#[cfg(not(feature = "never-type"))] -use std::convert::Infallible; -use std::{future::Future, pin::Pin}; +use std::{future::Future, pin::Pin, convert::Infallible /* used instead of `!` to be compatible with rust <1.41 */}; use async_trait::async_trait; @@ -73,28 +71,10 @@ where /// IgnoreSafe.handle_error(0); /// ``` /// -/// ## Note -/// Never type is not stabilized yet (see [`#35121`]) so all API that uses [`!`] -/// (including `impl ErrorPolicy for IgnoreSafe`) we hide under the -/// `never-type` cargo feature. -/// /// [`!`]: https://doc.rust-lang.org/std/primitive.never.html /// [`Infallible`]: std::convert::Infallible -/// [`#35121`]: https://github.com/rust-lang/rust/issues/35121 pub struct IgnoreSafe; -#[cfg(feature = "never-type")] -#[allow(unreachable_code)] -#[async_trait] -impl ErrorPolicy for IgnoreSafe { - async fn handle_error(&self, _: !) - where - !: 'async_trait, - { - } -} - -#[cfg(not(feature = "never-type"))] #[allow(unreachable_code)] #[async_trait] impl ErrorPolicy for IgnoreSafe { diff --git a/src/lib.rs b/src/lib.rs index ebefaf88..65bfbbbf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,5 @@ #![allow(clippy::unit_arg)] // TODO #![allow(clippy::ptr_arg)] // TODO -#![feature(never_type)] #[macro_use] extern crate derive_more;