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 benches/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extern crate hyper;

extern crate test;

use std::fmt::{self, Show};
use std::fmt;
use std::io::net::ip::Ipv4Addr;
use hyper::server::{Request, Response, Server};
use hyper::header::Headers;
Expand Down Expand Up @@ -44,7 +44,7 @@ impl hyper::header::Header for Foo {

impl hyper::header::HeaderFormat for Foo {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
"Bar".fmt(fmt)
fmt.write_str("Bar")
}
}

Expand Down
4 changes: 2 additions & 2 deletions benches/client_mock_tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extern crate hyper;

extern crate test;

use std::fmt::{self, Show};
use std::fmt;
use std::io::{IoResult, MemReader};
use std::io::net::ip::SocketAddr;

Expand Down Expand Up @@ -60,7 +60,7 @@ impl hyper::header::Header for Foo {

impl hyper::header::HeaderFormat for Foo {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
"Bar".fmt(fmt)
fmt.write_str("Bar")
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/header/common/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>);
Expand Down
2 changes: 1 addition & 1 deletion src/header/common/accept_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/header/common/allow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>);
Expand Down
6 changes: 3 additions & 3 deletions src/header/common/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -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,
Expand All @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/header/common/cache_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/header/common/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/header/common/content_length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/header/common/content_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/header/common/cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>);
Expand Down Expand Up @@ -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("; "));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/header/common/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/header/common/etag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/header/common/expires.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/header/common/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
};

Expand Down
4 changes: 2 additions & 2 deletions src/header/common/if_modified_since.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/header/common/last_modified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/header/common/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/header/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions src/header/common/referer.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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);
Expand All @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/header/common/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/header/common/set_cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>);
Expand Down
2 changes: 1 addition & 1 deletion src/header/common/transfer_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>);
Expand Down
Loading