Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/byte_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ impl From<String> for ByteStr {
}
}

impl<'a> From<&'a str> for ByteStr {
impl From<&str> for ByteStr {
#[inline]
fn from(src: &'a str) -> ByteStr {
fn from(src: &str) -> ByteStr {
ByteStr {
// Invariant: src is a str so contains valid UTF-8.
bytes: Bytes::copy_from_slice(src.as_bytes()),
Expand Down
16 changes: 8 additions & 8 deletions src/header/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3758,7 +3758,7 @@ mod into_header_name {

impl IntoHeaderName for HeaderName {}

impl<'a> Sealed for &'a HeaderName {
impl Sealed for &HeaderName {
#[inline]
fn try_insert<T>(
self,
Expand All @@ -3778,7 +3778,7 @@ mod into_header_name {
}
}

impl<'a> IntoHeaderName for &'a HeaderName {}
impl IntoHeaderName for &HeaderName {}

impl Sealed for &'static str {
#[inline]
Expand Down Expand Up @@ -3868,7 +3868,7 @@ mod as_header_name {

impl AsHeaderName for HeaderName {}

impl<'a> Sealed for &'a HeaderName {
impl Sealed for &HeaderName {
#[inline]
fn try_entry<T>(self, map: &mut HeaderMap<T>) -> Result<Entry<'_, T>, TryEntryError> {
Ok(map.try_entry2(self)?)
Expand All @@ -3884,9 +3884,9 @@ mod as_header_name {
}
}

impl<'a> AsHeaderName for &'a HeaderName {}
impl AsHeaderName for &HeaderName {}

impl<'a> Sealed for &'a str {
impl Sealed for &str {
#[inline]
fn try_entry<T>(self, map: &mut HeaderMap<T>) -> Result<Entry<'_, T>, TryEntryError> {
Ok(HdrName::from_bytes(self.as_bytes(), move |hdr| {
Expand All @@ -3904,7 +3904,7 @@ mod as_header_name {
}
}

impl<'a> AsHeaderName for &'a str {}
impl AsHeaderName for &str {}

impl Sealed for String {
#[inline]
Expand All @@ -3924,7 +3924,7 @@ mod as_header_name {

impl AsHeaderName for String {}

impl<'a> Sealed for &'a String {
impl Sealed for &String {
#[inline]
fn try_entry<T>(self, map: &mut HeaderMap<T>) -> Result<Entry<'_, T>, TryEntryError> {
self.as_str().try_entry(map)
Expand All @@ -3940,7 +3940,7 @@ mod as_header_name {
}
}

impl<'a> AsHeaderName for &'a String {}
impl AsHeaderName for &String {}
}

#[test]
Expand Down
28 changes: 14 additions & 14 deletions src/header/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,8 +1319,8 @@ impl InvalidHeaderName {
}
}

impl<'a> From<&'a HeaderName> for HeaderName {
fn from(src: &'a HeaderName) -> HeaderName {
impl From<&HeaderName> for HeaderName {
fn from(src: &HeaderName) -> HeaderName {
src.clone()
}
}
Expand All @@ -1345,26 +1345,26 @@ impl From<Custom> for Bytes {
}
}

impl<'a> TryFrom<&'a str> for HeaderName {
impl TryFrom<&str> for HeaderName {
type Error = InvalidHeaderName;
#[inline]
fn try_from(s: &'a str) -> Result<Self, Self::Error> {
fn try_from(s: &str) -> Result<Self, Self::Error> {
Self::from_bytes(s.as_bytes())
}
}

impl<'a> TryFrom<&'a String> for HeaderName {
impl TryFrom<&String> for HeaderName {
type Error = InvalidHeaderName;
#[inline]
fn try_from(s: &'a String) -> Result<Self, Self::Error> {
fn try_from(s: &String) -> Result<Self, Self::Error> {
Self::from_bytes(s.as_bytes())
}
}

impl<'a> TryFrom<&'a [u8]> for HeaderName {
impl TryFrom<&[u8]> for HeaderName {
type Error = InvalidHeaderName;
#[inline]
fn try_from(s: &'a [u8]) -> Result<Self, Self::Error> {
fn try_from(s: &[u8]) -> Result<Self, Self::Error> {
Self::from_bytes(s)
}
}
Expand Down Expand Up @@ -1405,14 +1405,14 @@ impl From<Custom> for HeaderName {
}
}

impl<'a> PartialEq<&'a HeaderName> for HeaderName {
impl PartialEq<&HeaderName> for HeaderName {
#[inline]
fn eq(&self, other: &&'a HeaderName) -> bool {
fn eq(&self, other: &&HeaderName) -> bool {
*self == **other
}
}

impl<'a> PartialEq<HeaderName> for &'a HeaderName {
impl PartialEq<HeaderName> for &HeaderName {
#[inline]
fn eq(&self, other: &HeaderName) -> bool {
*other == *self
Expand Down Expand Up @@ -1457,16 +1457,16 @@ impl PartialEq<HeaderName> for str {
}
}

impl<'a> PartialEq<&'a str> for HeaderName {
impl PartialEq<&str> for HeaderName {
/// Performs a case-insensitive comparison of the string against the header
/// name
#[inline]
fn eq(&self, other: &&'a str) -> bool {
fn eq(&self, other: &&str) -> bool {
*self == **other
}
}

impl<'a> PartialEq<HeaderName> for &'a str {
impl PartialEq<HeaderName> for &str {
/// Performs a case-insensitive comparison of the string against the header
/// name
#[inline]
Expand Down
32 changes: 16 additions & 16 deletions src/header/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,35 +484,35 @@ impl FromStr for HeaderValue {
}
}

impl<'a> From<&'a HeaderValue> for HeaderValue {
impl From<&HeaderValue> for HeaderValue {
#[inline]
fn from(t: &'a HeaderValue) -> Self {
fn from(t: &HeaderValue) -> Self {
t.clone()
}
}

impl<'a> TryFrom<&'a str> for HeaderValue {
impl TryFrom<&str> for HeaderValue {
type Error = InvalidHeaderValue;

#[inline]
fn try_from(t: &'a str) -> Result<Self, Self::Error> {
fn try_from(t: &str) -> Result<Self, Self::Error> {
t.parse()
}
}

impl<'a> TryFrom<&'a String> for HeaderValue {
impl TryFrom<&String> for HeaderValue {
type Error = InvalidHeaderValue;
#[inline]
fn try_from(s: &'a String) -> Result<Self, Self::Error> {
fn try_from(s: &String) -> Result<Self, Self::Error> {
Self::from_bytes(s.as_bytes())
}
}

impl<'a> TryFrom<&'a [u8]> for HeaderValue {
impl TryFrom<&[u8]> for HeaderValue {
type Error = InvalidHeaderValue;

#[inline]
fn try_from(t: &'a [u8]) -> Result<Self, Self::Error> {
fn try_from(t: &[u8]) -> Result<Self, Self::Error> {
HeaderValue::from_bytes(t)
}
}
Expand Down Expand Up @@ -697,48 +697,48 @@ impl PartialOrd<HeaderValue> for String {
}
}

impl<'a> PartialEq<HeaderValue> for &'a HeaderValue {
impl PartialEq<HeaderValue> for &HeaderValue {
#[inline]
fn eq(&self, other: &HeaderValue) -> bool {
**self == *other
}
}

impl<'a> PartialOrd<HeaderValue> for &'a HeaderValue {
impl PartialOrd<HeaderValue> for &HeaderValue {
#[inline]
fn partial_cmp(&self, other: &HeaderValue) -> Option<cmp::Ordering> {
(**self).partial_cmp(other)
}
}

impl<'a, T: ?Sized> PartialEq<&'a T> for HeaderValue
impl<T: ?Sized> PartialEq<&T> for HeaderValue
where
HeaderValue: PartialEq<T>,
{
#[inline]
fn eq(&self, other: &&'a T) -> bool {
fn eq(&self, other: &&T) -> bool {
*self == **other
}
}

impl<'a, T: ?Sized> PartialOrd<&'a T> for HeaderValue
impl<T: ?Sized> PartialOrd<&T> for HeaderValue
where
HeaderValue: PartialOrd<T>,
{
#[inline]
fn partial_cmp(&self, other: &&'a T) -> Option<cmp::Ordering> {
fn partial_cmp(&self, other: &&T) -> Option<cmp::Ordering> {
self.partial_cmp(*other)
}
}

impl<'a> PartialEq<HeaderValue> for &'a str {
impl PartialEq<HeaderValue> for &str {
#[inline]
fn eq(&self, other: &HeaderValue) -> bool {
*other == *self
}
}

impl<'a> PartialOrd<HeaderValue> for &'a str {
impl PartialOrd<HeaderValue> for &str {
#[inline]
fn partial_cmp(&self, other: &HeaderValue) -> Option<cmp::Ordering> {
self.as_bytes().partial_cmp(other.as_bytes())
Expand Down
24 changes: 12 additions & 12 deletions src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ impl AsRef<str> for Method {
}
}

impl<'a> PartialEq<&'a Method> for Method {
impl PartialEq<&Method> for Method {
#[inline]
fn eq(&self, other: &&'a Method) -> bool {
fn eq(&self, other: &&Method) -> bool {
self == *other
}
}

impl<'a> PartialEq<Method> for &'a Method {
impl PartialEq<Method> for &Method {
#[inline]
fn eq(&self, other: &Method) -> bool {
*self == other
Expand All @@ -215,14 +215,14 @@ impl PartialEq<Method> for str {
}
}

impl<'a> PartialEq<&'a str> for Method {
impl PartialEq<&str> for Method {
#[inline]
fn eq(&self, other: &&'a str) -> bool {
fn eq(&self, other: &&str) -> bool {
self.as_ref() == *other
}
}

impl<'a> PartialEq<Method> for &'a str {
impl PartialEq<Method> for &str {
#[inline]
fn eq(&self, other: &Method) -> bool {
*self == other.as_ref()
Expand All @@ -248,27 +248,27 @@ impl Default for Method {
}
}

impl<'a> From<&'a Method> for Method {
impl From<&Method> for Method {
#[inline]
fn from(t: &'a Method) -> Self {
fn from(t: &Method) -> Self {
t.clone()
}
}

impl<'a> TryFrom<&'a [u8]> for Method {
impl TryFrom<&[u8]> for Method {
type Error = InvalidMethod;

#[inline]
fn try_from(t: &'a [u8]) -> Result<Self, Self::Error> {
fn try_from(t: &[u8]) -> Result<Self, Self::Error> {
Method::from_bytes(t)
}
}

impl<'a> TryFrom<&'a str> for Method {
impl TryFrom<&str> for Method {
type Error = InvalidMethod;

#[inline]
fn try_from(t: &'a str) -> Result<Self, Self::Error> {
fn try_from(t: &str) -> Result<Self, Self::Error> {
TryFrom::try_from(t.as_bytes())
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,27 +263,27 @@ impl FromStr for StatusCode {
}
}

impl<'a> From<&'a StatusCode> for StatusCode {
impl From<&StatusCode> for StatusCode {
#[inline]
fn from(t: &'a StatusCode) -> Self {
fn from(t: &StatusCode) -> Self {
t.to_owned()
}
}

impl<'a> TryFrom<&'a [u8]> for StatusCode {
impl TryFrom<&[u8]> for StatusCode {
type Error = InvalidStatusCode;

#[inline]
fn try_from(t: &'a [u8]) -> Result<Self, Self::Error> {
fn try_from(t: &[u8]) -> Result<Self, Self::Error> {
StatusCode::from_bytes(t)
}
}

impl<'a> TryFrom<&'a str> for StatusCode {
impl TryFrom<&str> for StatusCode {
type Error = InvalidStatusCode;

#[inline]
fn try_from(t: &'a str) -> Result<Self, Self::Error> {
fn try_from(t: &str) -> Result<Self, Self::Error> {
t.parse()
}
}
Expand Down
Loading