other rustup fallout

This commit is contained in:
Sean McArthur
2014-12-23 14:04:21 -08:00
parent 79fc40cbce
commit 84b49cb364
4 changed files with 9 additions and 9 deletions

View File

@@ -42,7 +42,7 @@ impl HeaderFormat for Vary {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::Vary; use super::Vary;
use header::{Header, CaseInsensitive}; use header::Header;
#[test] #[test]
fn test_vary() { fn test_vary() {
@@ -52,8 +52,8 @@ mod tests {
assert_eq!(vary, Some(Vary::Any)); assert_eq!(vary, Some(Vary::Any));
vary = Header::parse_header([b"etag,cookie,allow".to_vec()].as_slice()); vary = Header::parse_header([b"etag,cookie,allow".to_vec()].as_slice());
assert_eq!(vary, Some(Vary::Headers(vec![from_str::<CaseInsensitive>("eTag").unwrap(), assert_eq!(vary, Some(Vary::Headers(vec!["eTag".parse().unwrap(),
from_str::<CaseInsensitive>("cookIE").unwrap(), "cookIE".parse().unwrap(),
from_str::<CaseInsensitive>("AlLOw").unwrap(),]))); "AlLOw".parse().unwrap(),])));
} }
} }

View File

@@ -549,7 +549,7 @@ mod tests {
#[test] #[test]
fn test_accept() { fn test_accept() {
let text_plain = Mime(Text, Plain, vec![]); let text_plain = Mime(Text, Plain, vec![]);
let application_vendor = from_str("application/vnd.github.v3.full+json; q=0.5").unwrap(); let application_vendor = "application/vnd.github.v3.full+json; q=0.5".parse().unwrap();
let accept = Header::parse_header([b"text/plain".to_vec()].as_slice()); let accept = Header::parse_header([b"text/plain".to_vec()].as_slice());
assert_eq!(accept, Some(Accept(vec![text_plain.clone()]))); assert_eq!(accept, Some(Accept(vec![text_plain.clone()])));
@@ -574,8 +574,8 @@ mod tests {
} }
// we JUST checked that raw.len() == 1, so raw[0] WILL exist. // we JUST checked that raw.len() == 1, so raw[0] WILL exist.
match from_utf8(unsafe { raw.as_slice().unsafe_get(0).as_slice() }) { match from_utf8(unsafe { raw.as_slice().unsafe_get(0).as_slice() }) {
Some(s) => FromStr::from_str(s), Ok(s) => FromStr::from_str(s),
None => None Err(_) => None
}.map(|u| CrazyLength(Some(false), u)) }.map(|u| CrazyLength(Some(false), u))
} }
} }

View File

@@ -62,7 +62,7 @@ impl Writer for MockStream {
impl NetworkStream for MockStream { impl NetworkStream for MockStream {
fn peer_name(&mut self) -> IoResult<SocketAddr> { fn peer_name(&mut self) -> IoResult<SocketAddr> {
Ok(from_str("127.0.0.1:1337").unwrap()) Ok("127.0.0.1:1337".parse().unwrap())
} }
} }

View File

@@ -179,7 +179,7 @@ pub trait Handler: Sync + Send {
fn handle(&self, Request, Response<Fresh>); fn handle(&self, Request, Response<Fresh>);
} }
impl Handler for fn(Request, Response<Fresh>) { impl<F> Handler for F where F: Fn(Request, Response<Fresh>), F: Sync + Send {
fn handle(&self, req: Request, res: Response<Fresh>) { fn handle(&self, req: Request, res: Response<Fresh>) {
(*self)(req, res) (*self)(req, res)
} }