rust upgrade

This commit is contained in:
Sean McArthur
2014-12-29 17:42:38 -08:00
parent f75e9bfaaa
commit 451074b0a6
5 changed files with 13 additions and 9 deletions

View File

@@ -16,6 +16,10 @@ use cookie::CookieJar;
#[deriving(Clone, PartialEq, Show)]
pub struct Cookies(pub Vec<Cookie>);
//TODO: remove when fixed in libstd
unsafe impl Send for Cookies {}
unsafe impl Sync for Cookies {}
deref!(Cookies -> Vec<Cookie>);
impl Header for Cookies {

View File

@@ -13,6 +13,10 @@ use cookie::CookieJar;
#[deriving(Clone, PartialEq, Show)]
pub struct SetCookie(pub Vec<Cookie>);
//TODO: remove when fixed in libstd
unsafe impl Send for SetCookie {}
unsafe impl Sync for SetCookie {}
deref!(SetCookie -> Vec<Cookie>);
impl Header for SetCookie {

View File

@@ -5,7 +5,7 @@
//! must implement the `Header` trait from this module. Several common headers
//! are already provided, such as `Host`, `ContentType`, `UserAgent`, and others.
use std::any::Any;
use std::ascii::{AsciiExt, AsciiCast};
use std::ascii::AsciiExt;
use std::borrow::Cow::{Borrowed, Owned};
use std::fmt::{mod, Show};
use std::intrinsics::TypeId;
@@ -127,7 +127,7 @@ impl Headers {
loop {
match try!(http::read_header(rdr)) {
Some((name, value)) => {
debug!("raw header: {}={}", name, value[].to_ascii());
debug!("raw header: {}={}", name, value[]);
let name = CaseInsensitive(Owned(name));
let mut item = match headers.data.entry(name) {
Entry::Vacant(entry) => entry.set(MuCell::new(Item::raw(vec![]))),
@@ -488,7 +488,7 @@ impl<H: hash::Writer> hash::Hash<H> for CaseInsensitive {
#[inline]
fn hash(&self, hasher: &mut H) {
for b in self.as_slice().bytes() {
hasher.write(&[b.to_ascii().to_lowercase().as_byte()])
hasher.write(&[b.to_ascii_lowercase()])
}
}
}

View File

@@ -376,8 +376,6 @@ pub fn read_method<R: Reader>(stream: &mut R) -> HttpResult<method::Method> {
return Err(HttpMethodError);
}
debug!("method buf = {}", buf[].to_ascii());
let maybe_method = match buf[0..7] {
b"GET " => Some(method::Method::Get),
b"PUT " => Some(method::Method::Put),
@@ -548,8 +546,6 @@ pub fn read_header<R: Reader>(stream: &mut R) -> HttpResult<Option<RawHeaderLine
let real_len = value.len() - value.iter().rev().take_while(|&&x| b' ' == x).count();
value.truncate(real_len);
debug!("header value = {}", value[].to_ascii());
match try!(stream.read_byte()) {
LF => Ok(Some((name, value))),
_ => Err(HttpHeaderError)

View File

@@ -154,7 +154,7 @@ use self::HttpError::{HttpMethodError, HttpUriError, HttpVersionError,
macro_rules! todo(
($($arg:tt)*) => (if cfg!(not(ndebug)) {
format_args!(|args| log!(5, "TODO: {}", args), $($arg)*)
log!(5, "TODO: {}", format_args!($($arg)*))
})
);
@@ -170,7 +170,7 @@ impl fmt::Show for Trace {
macro_rules! trace(
($($arg:tt)*) => (if cfg!(not(ndebug)) {
format_args!(|args| log!(5, "{}\n{}", args, ::Trace), $($arg)*)
log!(5, "{}\n{}", format_args!($($arg)*), ::Trace)
})
);