From 09156a70a63ce1740bc0d3ecff9db5861bffb389 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 28 Sep 2018 12:02:21 -0700 Subject: [PATCH] refactor(lib): remove build script features since minimum version is higher --- Cargo.toml | 3 --- build.rs | 13 ------------- src/client/conn.rs | 12 ++++++------ src/common/macros.rs | 21 --------------------- src/common/mod.rs | 2 -- src/headers.rs | 2 -- 6 files changed, 6 insertions(+), 47 deletions(-) delete mode 100644 build.rs delete mode 100644 src/common/macros.rs diff --git a/Cargo.toml b/Cargo.toml index 9435f562..b8ea6db3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,9 +49,6 @@ serde = "1.0" serde_derive = "1.0" serde_json = "1.0" -[build-dependencies] -rustc_version = "0.2.3" - [features] default = [ "__internal_flaky_tests", diff --git a/build.rs b/build.rs deleted file mode 100644 index 6107783a..00000000 --- a/build.rs +++ /dev/null @@ -1,13 +0,0 @@ -extern crate rustc_version; -use rustc_version::{version, Version}; - -fn main() { - // Check for a minimum version to see if new rust features can be used - let version = version().unwrap(); - if version >= Version::parse("1.26.0").unwrap() { - println!("cargo:rustc-cfg=__hyper_impl_trait_available"); - } - if version >= Version::parse("1.23.0").unwrap() { - println!("cargo:rustc-cfg=__hyper_inherent_ascii"); - } -} diff --git a/src/client/conn.rs b/src/client/conn.rs index 63ccab40..60a04788 100644 --- a/src/client/conn.rs +++ b/src/client/conn.rs @@ -240,11 +240,11 @@ where } } - pub(crate) fn send_request_retryable(&mut self, req: Request) -> impl_trait!(ty: Future, Error = (::Error, Option>)> + Send) + pub(crate) fn send_request_retryable(&mut self, req: Request) -> impl Future, Error = (::Error, Option>)> where B: Send, { - impl_trait!(e: match self.dispatch.try_send(req) { + match self.dispatch.try_send(req) { Ok(rx) => { Either::A(rx.then(move |res| { match res { @@ -260,7 +260,7 @@ where let err = ::Error::new_canceled(Some("connection was not ready")); Either::B(future::err((err, Some(req)))) } - }) + } } } @@ -300,11 +300,11 @@ impl Http2SendRequest where B: Payload + 'static, { - pub(super) fn send_request_retryable(&mut self, req: Request) -> impl_trait!(ty: Future, Error=(::Error, Option>)> + Send) + pub(super) fn send_request_retryable(&mut self, req: Request) -> impl Future, Error=(::Error, Option>)> where B: Send, { - impl_trait!(e: match self.dispatch.try_send(req) { + match self.dispatch.try_send(req) { Ok(rx) => { Either::A(rx.then(move |res| { match res { @@ -320,7 +320,7 @@ where let err = ::Error::new_canceled(Some("connection was not ready")); Either::B(future::err((err, Some(req)))) } - }) + } } } diff --git a/src/common/macros.rs b/src/common/macros.rs deleted file mode 100644 index 27e2bb56..00000000 --- a/src/common/macros.rs +++ /dev/null @@ -1,21 +0,0 @@ -#[macro_export] -#[cfg(__hyper_impl_trait_available)] -macro_rules! impl_trait { - (ty: $($t:tt)+) => { - impl $($t)+ - }; - (e: $e:expr) => { - $e - } -} - -#[macro_export] -#[cfg(not(__hyper_impl_trait_available))] -macro_rules! impl_trait { - (ty: $($t:tt)+) => { - Box<$($t)+> - }; - (e: $e:expr) => { - Box::new($e) - } -} diff --git a/src/common/mod.rs b/src/common/mod.rs index c8ced418..7e2a170d 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -3,8 +3,6 @@ pub(crate) mod drain; mod exec; pub(crate) mod io; mod lazy; -#[macro_use] -mod macros; mod never; pub(crate) use self::buf::StaticBuf; diff --git a/src/headers.rs b/src/headers.rs index a2b740ae..52fcaba8 100644 --- a/src/headers.rs +++ b/src/headers.rs @@ -2,8 +2,6 @@ use bytes::BytesMut; use http::HeaderMap; use http::header::{CONTENT_LENGTH, TRANSFER_ENCODING}; use http::header::{HeaderValue, OccupiedEntry, ValueIter}; -#[cfg(not(__hyper_inherent_ascii))] -use std::ascii::AsciiExt; pub fn connection_keep_alive(value: &HeaderValue) -> bool { connection_has(value, "keep-alive")