From c917765eec7aa117ba733970cc7700bd7a527d46 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Thu, 29 Mar 2018 11:46:08 -0700 Subject: [PATCH] fix conflicts with new TryFrom trait --- src/header/name.rs | 4 ++-- src/method.rs | 4 ++-- src/request.rs | 8 ++++---- src/response.rs | 6 +++--- src/uri/authority.rs | 3 ++- src/uri/mod.rs | 3 ++- src/uri/scheme.rs | 3 ++- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/header/name.rs b/src/header/name.rs index 71ae5184d..4596f2cda 100644 --- a/src/header/name.rs +++ b/src/header/name.rs @@ -125,14 +125,14 @@ macro_rules! standard_headers { let bytes: Bytes = HeaderName::from_bytes(name_bytes).unwrap().into(); assert_eq!(bytes, name_bytes); - assert_eq!(HeaderName::try_from(Bytes::from(name_bytes)).unwrap(), std); + assert_eq!(HeaderName::from_bytes(name_bytes).unwrap(), std); // Test upper case let upper = name.to_uppercase().to_string(); let bytes: Bytes = HeaderName::from_bytes(upper.as_bytes()).unwrap().into(); assert_eq!(bytes, name.as_bytes()); - assert_eq!(HeaderName::try_from(Bytes::from(upper.as_bytes())).unwrap(), + assert_eq!(HeaderName::from_bytes(upper.as_bytes()).unwrap(), std); diff --git a/src/method.rs b/src/method.rs index 6f28fef84..d8f1bfbfb 100644 --- a/src/method.rs +++ b/src/method.rs @@ -322,7 +322,7 @@ impl<'a> HttpTryFrom<&'a str> for Method { #[inline] fn try_from(t: &'a str) -> Result { - Method::try_from(t.as_bytes()) + HttpTryFrom::try_from(t.as_bytes()) } } @@ -331,7 +331,7 @@ impl FromStr for Method { #[inline] fn from_str(t: &str) -> Result { - Method::try_from(t) + HttpTryFrom::try_from(t) } } diff --git a/src/request.rs b/src/request.rs index 7917b1465..b71d38e15 100644 --- a/src/request.rs +++ b/src/request.rs @@ -764,7 +764,7 @@ impl Builder { where Method: HttpTryFrom, { if let Some(head) = head(&mut self.head, &self.err) { - match Method::try_from(method) { + match HttpTryFrom::try_from(method) { Ok(s) => head.method = s, Err(e) => self.err = Some(e.into()), } @@ -793,7 +793,7 @@ impl Builder { where Uri: HttpTryFrom, { if let Some(head) = head(&mut self.head, &self.err) { - match Uri::try_from(uri) { + match HttpTryFrom::try_from(uri) { Ok(s) => head.uri = s, Err(e) => self.err = Some(e.into()), } @@ -848,9 +848,9 @@ impl Builder { HeaderValue: HttpTryFrom { if let Some(head) = head(&mut self.head, &self.err) { - match HeaderName::try_from(key) { + match >::try_from(key) { Ok(key) => { - match HeaderValue::try_from(value) { + match >::try_from(value) { Ok(value) => { head.headers.append(key, value); } Err(e) => self.err = Some(e.into()), } diff --git a/src/response.rs b/src/response.rs index cb780dce3..edfbb56b4 100644 --- a/src/response.rs +++ b/src/response.rs @@ -561,7 +561,7 @@ impl Builder { where StatusCode: HttpTryFrom, { if let Some(head) = head(&mut self.head, &self.err) { - match StatusCode::try_from(status) { + match HttpTryFrom::try_from(status) { Ok(s) => head.status = s, Err(e) => self.err = Some(e.into()), } @@ -616,9 +616,9 @@ impl Builder { HeaderValue: HttpTryFrom { if let Some(head) = head(&mut self.head, &self.err) { - match HeaderName::try_from(key) { + match >::try_from(key) { Ok(key) => { - match HeaderValue::try_from(value) { + match >::try_from(value) { Ok(value) => { head.headers.append(key, value); } Err(e) => self.err = Some(e.into()), } diff --git a/src/uri/authority.rs b/src/uri/authority.rs index 877ef5d9f..2153ff7ee 100644 --- a/src/uri/authority.rs +++ b/src/uri/authority.rs @@ -1,4 +1,5 @@ -#[allow(unused)] +// Deprecated in 1.26, needed until our minimum version is >=1.23. +#[allow(unused, deprecated)] use std::ascii::AsciiExt; use std::{cmp, fmt, str}; use std::hash::{Hash, Hasher}; diff --git a/src/uri/mod.rs b/src/uri/mod.rs index bd980b592..85b276bd9 100644 --- a/src/uri/mod.rs +++ b/src/uri/mod.rs @@ -28,7 +28,8 @@ use byte_str::ByteStr; use bytes::Bytes; use std::{fmt, u8, u16}; -#[allow(unused)] +// Deprecated in 1.26, needed until our minimum version is >=1.23. +#[allow(unused, deprecated)] use std::ascii::AsciiExt; use std::hash::{Hash, Hasher}; use std::str::{self, FromStr}; diff --git a/src/uri/scheme.rs b/src/uri/scheme.rs index ae40ff6ec..5fa1e9bb0 100644 --- a/src/uri/scheme.rs +++ b/src/uri/scheme.rs @@ -1,4 +1,5 @@ -#[allow(unused)] +// Deprecated in 1.26, needed until our minimum version is >=1.23. +#[allow(unused, deprecated)] use std::ascii::AsciiExt; use std::fmt; use std::hash::{Hash, Hasher};