From 05255c7f7c92d785bac919f39374efa9985eec57 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 14 Dec 2021 19:57:18 +0000 Subject: [PATCH] remove either crate conversions (#2516) --- CHANGES.md | 2 ++ Cargo.toml | 1 - src/types/either.rs | 25 ++++--------------------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2df820027..b8d3ce8de 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,8 +10,10 @@ ### Removed * Top-level `EitherExtractError` export. [#2510] +* Conversion implementations for `either` crate. [#2516] [#2510]: https://github.com/actix/actix-web/pull/2510 +[#2516]: https://github.com/actix/actix-web/pull/2516 ## 4.0.0-beta.14 - 2021-12-11 diff --git a/Cargo.toml b/Cargo.toml index 96e2dd797..e20529e1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,7 +86,6 @@ bytes = "1" cfg-if = "1" cookie = { version = "0.15", features = ["percent-encode"], optional = true } derive_more = "0.99.5" -either = "1.5.3" encoding_rs = "0.8" futures-core = { version = "0.3.7", default-features = false } futures-util = { version = "0.3.7", default-features = false } diff --git a/src/types/either.rs b/src/types/either.rs index 3c759736e..5b8e02525 100644 --- a/src/types/either.rs +++ b/src/types/either.rs @@ -12,7 +12,8 @@ use futures_core::ready; use pin_project_lite::pin_project; use crate::{ - body, dev, + body::EitherBody, + dev, web::{Form, Json}, Error, FromRequest, HttpRequest, HttpResponse, Responder, }; @@ -101,24 +102,6 @@ impl Either, Form> { } } -impl From> for Either { - fn from(val: either::Either) -> Self { - match val { - either::Either::Left(l) => Either::Left(l), - either::Either::Right(r) => Either::Right(r), - } - } -} - -impl From> for either::Either { - fn from(val: Either) -> Self { - match val { - Either::Left(l) => either::Either::Left(l), - Either::Right(r) => either::Either::Right(r), - } - } -} - #[cfg(test)] impl Either { pub(self) fn unwrap_left(self) -> L { @@ -146,7 +129,7 @@ where L: Responder, R: Responder, { - type Body = body::EitherBody; + type Body = EitherBody; fn respond_to(self, req: &HttpRequest) -> HttpResponse { match self { @@ -165,7 +148,7 @@ pub enum EitherExtractError { /// Error from payload buffering, such as exceeding payload max size limit. Bytes(Error), - /// Error from primary extractor. + /// Error from primary and fallback extractors. Extract(L, R), }