fix(rustup): update to newest fmt trait names and slice syntax

This commit is contained in:
Sean McArthur
2015-01-23 14:17:19 -08:00
parent bb4f913ede
commit 9e3c94d764
38 changed files with 90 additions and 114 deletions

View File

@@ -25,7 +25,7 @@ use mime;
/// qitem(Mime(Text, Html, vec![])),
/// qitem(Mime(Text, Xml, vec![])) ]));
/// ```
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Accept(pub Vec<header::QualityItem<mime::Mime>>);
deref!(Accept => Vec<header::QualityItem<mime::Mime>>);

View File

@@ -4,7 +4,7 @@ use header::{self, Encoding, QualityItem};
///
/// The `Accept-Encoding` header can be used by clients to indicate what
/// response encodings they accept.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct AcceptEncoding(pub Vec<QualityItem<Encoding>>);
impl_list_header!(AcceptEncoding,

View File

@@ -6,7 +6,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited};
/// The `Allow` header.
/// See also https://tools.ietf.org/html/rfc7231#section-7.4.1
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Allow(pub Vec<Method>);
deref!(Allow => Vec<Method>);

View File

@@ -5,7 +5,7 @@ use serialize::base64::{ToBase64, FromBase64, Standard, Config, Newline};
use header::{Header, HeaderFormat};
/// The `Authorization` header field.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Authorization<S: Scheme>(pub S);
impl<S: Scheme> Deref for Authorization<S> {
@@ -75,7 +75,7 @@ impl Scheme for String {
}
/// Credential holder for Basic Authentication
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Basic {
/// The username as a possibly empty string
pub username: String,
@@ -90,7 +90,7 @@ impl Scheme for Basic {
}
fn fmt_scheme(&self, f: &mut fmt::Formatter) -> fmt::Result {
//FIXME: serialize::base64 could use some Show implementation, so
//FIXME: serialize::base64 could use some Debug implementation, so
//that we don't have to allocate a new string here just to write it
//to the formatter.
let mut text = self.username.clone();

View File

@@ -4,7 +4,7 @@ use header::{Header, HeaderFormat};
use header::parsing::{from_one_comma_delimited, fmt_comma_delimited};
/// The Cache-Control header.
#[derive(PartialEq, Clone, Show)]
#[derive(PartialEq, Clone, Debug)]
pub struct CacheControl(pub Vec<CacheDirective>);
deref!(CacheControl => Vec<CacheDirective>);
@@ -34,7 +34,7 @@ impl HeaderFormat for CacheControl {
}
/// CacheControl contains a list of these directives.
#[derive(PartialEq, Clone, Show)]
#[derive(PartialEq, Clone, Debug)]
pub enum CacheDirective {
/// "no-cache"
NoCache,
@@ -69,10 +69,10 @@ pub enum CacheDirective {
Extension(String, Option<String>)
}
impl fmt::String for CacheDirective {
impl fmt::Display for CacheDirective {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use self::CacheDirective::*;
fmt::String::fmt(match *self {
fmt::Display::fmt(match *self {
NoCache => "no-cache",
NoStore => "no-store",
NoTransform => "no-transform",

View File

@@ -6,13 +6,13 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited};
pub use self::ConnectionOption::{KeepAlive, Close, ConnectionHeader};
/// The `Connection` header.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Connection(pub Vec<ConnectionOption>);
deref!(Connection => Vec<ConnectionOption>);
/// Values that can be in the `Connection` header.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub enum ConnectionOption {
/// The `keep-alive` connection value.
KeepAlive,
@@ -39,7 +39,7 @@ impl FromStr for ConnectionOption {
}
}
impl fmt::String for ConnectionOption {
impl fmt::Display for ConnectionOption {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{}", match *self {
KeepAlive => "keep-alive",

View File

@@ -6,7 +6,7 @@ use header::parsing::from_one_raw_str;
/// The `Content-Length` header.
///
/// Simply a wrapper around a `usize`.
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct ContentLength(pub u64);
deref!(ContentLength => u64);
@@ -23,7 +23,7 @@ impl Header for ContentLength {
impl HeaderFormat for ContentLength {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&self.0, fmt)
fmt::Display::fmt(&self.0, fmt)
}
}

View File

@@ -7,7 +7,7 @@ use mime::Mime;
///
/// Used to describe the MIME type of message body. Can be used with both
/// requests and responses.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct ContentType(pub Mime);
deref!(ContentType => Mime);
@@ -24,7 +24,7 @@ impl Header for ContentType {
impl HeaderFormat for ContentType {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&self.0, fmt)
fmt::Display::fmt(&self.0, fmt)
}
}

View File

@@ -13,7 +13,7 @@ use cookie::CookieJar;
///
/// > When the user agent generates an HTTP request, the user agent MUST NOT
/// > attach more than one Cookie header field.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Cookies(pub Vec<Cookie>);
deref!(Cookies => Vec<Cookie>);
@@ -53,7 +53,7 @@ impl HeaderFormat for Cookies {
let last = cookies.len() - 1;
for (i, cookie) in cookies.iter().enumerate() {
try!(write!(fmt, "{}", cookie.pair()));
if i < last {
if i < last {
try!(fmt.write_str("; "));
}
}

View File

@@ -7,7 +7,7 @@ use header::parsing::tm_from_str;
// Egh, replace as soon as something better than time::Tm exists.
/// The `Date` header field.
#[derive(Copy, PartialEq, Clone, Show)]
#[derive(Copy, PartialEq, Clone, Debug)]
pub struct Date(pub Tm);
deref!(Date => Tm);
@@ -30,7 +30,7 @@ impl HeaderFormat for Date {
0 => tm,
_ => tm.to_utc(),
};
fmt::String::fmt(&tm.rfc822(), fmt)
fmt::Display::fmt(&tm.rfc822(), fmt)
}
}

View File

@@ -8,7 +8,7 @@ use header::parsing::from_one_raw_str;
/// Preceding the first double quote is an optional weakness indicator,
/// which always looks like this: W/
/// See also: https://tools.ietf.org/html/rfc7232#section-2.3
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Etag {
/// Weakness indicator for the tag
pub weak: bool,

View File

@@ -6,7 +6,7 @@ use header::parsing::from_one_raw_str;
use header::parsing::tm_from_str;
/// The `Expires` header field.
#[derive(Copy, PartialEq, Clone, Show)]
#[derive(Copy, PartialEq, Clone, Debug)]
pub struct Expires(pub Tm);
deref!(Expires => Tm);
@@ -29,7 +29,7 @@ impl HeaderFormat for Expires {
0 => tm,
_ => tm.to_utc(),
};
fmt::String::fmt(&tm.rfc822(), fmt)
fmt::Display::fmt(&tm.rfc822(), fmt)
}
}

View File

@@ -10,7 +10,7 @@ use header::parsing::from_one_raw_str;
///
/// Currently is just a String, but it should probably become a better type,
/// like url::Host or something.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Host {
/// The hostname, such a example.domain.
pub hostname: String,
@@ -46,7 +46,7 @@ impl Header for Host {
};
let port = match idx {
Some(idx) => s[].slice_from(idx + 1).parse(),
Some(idx) => s[idx + 1..].parse(),
None => None
};

View File

@@ -6,7 +6,7 @@ use header::parsing::from_one_raw_str;
use header::parsing::tm_from_str;
/// The `If-Modified-Since` header field.
#[derive(Copy, PartialEq, Clone, Show)]
#[derive(Copy, PartialEq, Clone, Debug)]
pub struct IfModifiedSince(pub Tm);
deref!(IfModifiedSince => Tm);
@@ -29,7 +29,7 @@ impl HeaderFormat for IfModifiedSince {
0 => tm,
_ => tm.to_utc(),
};
fmt::String::fmt(&tm.rfc822(), fmt)
fmt::Display::fmt(&tm.rfc822(), fmt)
}
}

View File

@@ -6,7 +6,7 @@ use header::parsing::from_one_raw_str;
use header::parsing::tm_from_str;
/// The `LastModified` header field.
#[derive(Copy, PartialEq, Clone, Show)]
#[derive(Copy, PartialEq, Clone, Debug)]
pub struct LastModified(pub Tm);
deref!(LastModified => Tm);
@@ -29,7 +29,7 @@ impl HeaderFormat for LastModified {
0 => tm,
_ => tm.to_utc(),
};
fmt::String::fmt(&tm.rfc822(), fmt)
fmt::Display::fmt(&tm.rfc822(), fmt)
}
}

View File

@@ -13,7 +13,7 @@ use header::parsing::from_one_raw_str;
///
/// Currently is just a String, but it should probably become a better type,
/// like url::Url or something.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Location(pub String);
deref!(Location => String);

View File

@@ -101,7 +101,7 @@ macro_rules! impl_list_header(
}
}
impl ::std::fmt::String for $from {
impl ::std::fmt::Display for $from {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
use header::HeaderFormat;
self.fmt_header(f)
@@ -127,11 +127,11 @@ macro_rules! impl_header(
impl header::HeaderFormat for $from {
fn fmt_header(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
::std::fmt::String::fmt(&**self, f)
::std::fmt::Display::fmt(&**self, f)
}
}
impl ::std::fmt::String for $from {
impl ::std::fmt::Display for $from {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
use header::HeaderFormat;
self.fmt_header(f)

View File

@@ -1,5 +1,5 @@
use header::{Header, HeaderFormat};
use std::fmt::{self, Show};
use std::fmt;
use header::parsing::from_one_raw_str;
/// The `Referer` header.
@@ -10,7 +10,7 @@ use header::parsing::from_one_raw_str;
/// See alse [RFC 1945, section 10.13](http://tools.ietf.org/html/rfc1945#section-10.13).
///
/// Currently just a string, but maybe better replace it with url::Url or something like it.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Referer(pub String);
deref!(Referer => String);
@@ -27,8 +27,7 @@ impl Header for Referer {
impl HeaderFormat for Referer {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let Referer(ref value) = *self;
value.fmt(fmt)
fmt::Display::fmt(&self.0, fmt)
}
}

View File

@@ -3,7 +3,7 @@ use header;
/// The `Server` header field.
///
/// They can contain any value, so it just wraps a `String`.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Server(pub String);
impl_header!(Server,

View File

@@ -10,7 +10,7 @@ use cookie::CookieJar;
/// Informally, the Set-Cookie response header contains the header name
/// "Set-Cookie" followed by a ":" and a cookie. Each cookie begins with
/// a name-value-pair, followed by zero or more attribute-value pairs.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct SetCookie(pub Vec<Cookie>);
deref!(SetCookie => Vec<Cookie>);

View File

@@ -16,7 +16,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited};
/// this header should include `chunked` as the last encoding.
///
/// The implementation uses a vector of `Encoding` values.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct TransferEncoding(pub Vec<Encoding>);
deref!(TransferEncoding => Vec<Encoding>);

View File

@@ -6,13 +6,13 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited};
use self::Protocol::{WebSocket, ProtocolExt};
/// The `Upgrade` header.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Upgrade(pub Vec<Protocol>);
deref!(Upgrade => Vec<Protocol>);
/// Protocol values that can appear in the Upgrade header.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub enum Protocol {
/// The websocket protocol.
WebSocket,
@@ -29,7 +29,7 @@ impl FromStr for Protocol {
}
}
impl fmt::String for Protocol {
impl fmt::Display for Protocol {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{}", match *self {
WebSocket => "websocket",

View File

@@ -5,7 +5,7 @@ use header::parsing::from_one_raw_str;
/// The `User-Agent` header field.
///
/// They can contain any value, so it just wraps a `String`.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct UserAgent(pub String);
deref!(UserAgent => String);

View File

@@ -6,7 +6,7 @@ use unicase::UniCase;
/// The `Allow` header.
/// See also https://tools.ietf.org/html/rfc7231#section-7.1.4
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub enum Vary {
/// This corresponds to '*'.
Any,