Skip to content

Commit 6a80399

Browse files
committed
fix: rustup
* enable slice_patterns feature * add `Reflect` trait bounds where necessary
1 parent 8e1cd5e commit 6a80399

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/header/common/authorization.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::fmt;
22
use std::str::{FromStr, from_utf8};
33
use std::ops::{Deref, DerefMut};
4+
use std::marker::Reflect;
45
use serialize::base64::{ToBase64, FromBase64, Standard, Config, Newline};
56
use header::{Header, HeaderFormat};
67

@@ -22,7 +23,7 @@ impl<S: Scheme> DerefMut for Authorization<S> {
2223
}
2324
}
2425

25-
impl<S: Scheme + 'static> Header for Authorization<S> where <S as FromStr>::Err: 'static {
26+
impl<S: Scheme + Reflect + 'static> Header for Authorization<S> where <S as FromStr>::Err: 'static {
2627
fn header_name() -> &'static str {
2728
"Authorization"
2829
}
@@ -43,7 +44,7 @@ impl<S: Scheme + 'static> Header for Authorization<S> where <S as FromStr>::Err:
4344
}
4445
}
4546

46-
impl<S: Scheme + 'static> HeaderFormat for Authorization<S> where <S as FromStr>::Err: 'static {
47+
impl<S: Scheme + Reflect + 'static> HeaderFormat for Authorization<S> where <S as FromStr>::Err: 'static {
4748
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
4849
match Scheme::scheme(None::<S>) {
4950
Some(scheme) => try!(write!(fmt, "{} ", scheme)),

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![doc(html_root_url = "https://hyperium.github.io/hyper/hyper/index.html")]
2-
#![feature(core, io, unsafe_destructor, into_cow, convert)]
2+
#![feature(core, io, unsafe_destructor, into_cow, convert, slice_patterns)]
33
#![deny(missing_docs)]
44
#![cfg_attr(test, deny(warnings))]
55
#![cfg_attr(test, feature(alloc, test))]

src/net.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::mem;
77
use std::path::Path;
88
use std::raw::{self, TraitObject};
99
use std::sync::Arc;
10+
use std::marker::Reflect;
1011

1112
use openssl::ssl::{Ssl, SslStream, SslContext};
1213
use openssl::ssl::SslVerifyMode::SslVerifyNone;
@@ -117,13 +118,13 @@ impl NetworkStream + Send {
117118
impl NetworkStream + Send {
118119
/// Is the underlying type in this trait object a T?
119120
#[inline]
120-
pub fn is<T: 'static>(&self) -> bool {
121+
pub fn is<T: Reflect + 'static>(&self) -> bool {
121122
self.get_type_id() == TypeId::of::<T>()
122123
}
123124

124125
/// If the underlying type is T, get a reference to the contained data.
125126
#[inline]
126-
pub fn downcast_ref<T: 'static>(&self) -> Option<&T> {
127+
pub fn downcast_ref<T: Reflect + 'static>(&self) -> Option<&T> {
127128
if self.is::<T>() {
128129
Some(unsafe { self.downcast_ref_unchecked() })
129130
} else {
@@ -134,7 +135,7 @@ impl NetworkStream + Send {
134135
/// If the underlying type is T, get a mutable reference to the contained
135136
/// data.
136137
#[inline]
137-
pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> {
138+
pub fn downcast_mut<T: Reflect + 'static>(&mut self) -> Option<&mut T> {
138139
if self.is::<T>() {
139140
Some(unsafe { self.downcast_mut_unchecked() })
140141
} else {
@@ -143,7 +144,7 @@ impl NetworkStream + Send {
143144
}
144145

145146
/// If the underlying type is T, extract it.
146-
pub fn downcast<T: 'static>(self: Box<NetworkStream + Send>)
147+
pub fn downcast<T: Reflect + 'static>(self: Box<NetworkStream + Send>)
147148
-> Result<Box<T>, Box<NetworkStream + Send>> {
148149
if self.is::<T>() {
149150
Ok(unsafe { self.downcast_unchecked() })

0 commit comments

Comments
 (0)