Skip to content

Commit

Permalink
Fix for nightly
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Gutierrez S <rgs@itevenworks.net>
  • Loading branch information
rgs1 committed Jan 24, 2015
1 parent d3bb9e6 commit 53d30c0
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 27 deletions.
4 changes: 2 additions & 2 deletions codegen/status.rs
Expand Up @@ -173,7 +173,7 @@ use std::num::{ToPrimitive, FromPrimitive};
pub use self::Status::*;
/// HTTP status code
#[derive(Eq, PartialEq, Clone)]
#[derive(Eq, PartialEq, Clone, Debug)]
pub enum Status {
".as_bytes()));
for &entry in entries.iter() {
Expand Down Expand Up @@ -245,7 +245,7 @@ impl Status {
}
}
impl fmt::Show for Status {
impl fmt::Display for Status {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, \"{} {}\", self.code(), self.reason())
}
Expand Down
4 changes: 2 additions & 2 deletions src/http/headers/accept_ranges.rs
Expand Up @@ -6,14 +6,14 @@ use std::ascii::AsciiExt;
pub use self::AcceptableRanges::{RangeUnits, NoAcceptableRanges};
pub use self::RangeUnit::{Bytes, OtherRangeUnit};

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
// RFC 2616: range-unit = bytes-unit | other-range-unit
pub enum RangeUnit {
Bytes, // bytes-unit = "bytes"
OtherRangeUnit(String), // other-range-unit = token
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
// RFC 2616: acceptable-ranges = 1#range-unit | "none"
pub enum AcceptableRanges {
RangeUnits(Vec<RangeUnit>),
Expand Down
6 changes: 3 additions & 3 deletions src/http/headers/connection.rs
Expand Up @@ -4,21 +4,21 @@
// whether they should be interpreted (I recall its being a header name thing for legacy code,
// perhaps I should normalise header case or some such thing?)

use std::fmt;
use std::fmt::{self, Display};
use std::io::IoResult;
use headers::serialization_utils::normalise_header_name;

use self::Connection::{Token, Close};

/// A value for the Connection header. Note that should it be a ``Token``, the string is in
/// normalised header case (e.g. "Keep-Alive").
#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum Connection {
Token(String),
Close,
}

impl fmt::Show for Connection {
impl fmt::Display for Connection {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(match *self {
Token(ref s) => &s[],
Expand Down
8 changes: 4 additions & 4 deletions src/http/headers/content_type.rs
@@ -1,9 +1,9 @@
//! The Content-Type entity header, defined in RFC 2616, Section 14.17.
use headers::serialization_utils::{push_parameters, WriterUtil};
use std::io::IoResult;
use std::fmt;
use std::fmt::{self, Display};

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct MediaType {
pub type_: String,
pub subtype: String,
Expand All @@ -22,7 +22,7 @@ impl MediaType {



impl fmt::Show for MediaType {
impl fmt::Display for MediaType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Idea:
//let s = String::new();
Expand Down Expand Up @@ -71,7 +71,7 @@ impl super::HeaderConvertible for MediaType {
}

fn http_value(&self) -> String {
format!("{:?}", self)
format!("{}", self)
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/http/headers/etag.rs
Expand Up @@ -2,7 +2,7 @@ use headers::serialization_utils::{push_quoted_string, quoted_string, WriterUtil
use std::io::IoResult;
use std::fmt;

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct EntityTag {
pub weak: bool,
pub opaque_tag: String,
Expand All @@ -22,7 +22,7 @@ pub fn strong_etag(opaque_tag: String) -> EntityTag {
}
}

impl fmt::Show for EntityTag {
impl fmt::Display for EntityTag {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.weak {
f.write_str(&push_quoted_string(String::from_str("W/"), &self.opaque_tag)[])
Expand Down Expand Up @@ -66,7 +66,7 @@ impl super::HeaderConvertible for EntityTag {
}

fn http_value(&self) -> String {
format!("{:?}", self)
format!("{}", self)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/http/headers/host.rs
Expand Up @@ -4,7 +4,7 @@ use std::io::Reader;
use std::fmt;

/// A simple little thing for the host of a request
#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct Host {

/// The name of the host that was requested
Expand All @@ -16,7 +16,7 @@ pub struct Host {
pub port: Option<u16>,
}

impl fmt::Show for Host {
impl fmt::Display for Host {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.port {
Some(port) => write!(f, "{}:{}", self.name, port),
Expand Down
3 changes: 2 additions & 1 deletion src/http/headers/mod.rs
Expand Up @@ -5,6 +5,7 @@
//! unknown headers are stored in a map in the traditional way.

use url::Url;
use std::fmt::Debug;
use std::io::IoResult;
use time::{Tm, strptime};
use rfc2616::{is_token_item, is_separator, CR, LF, SP, HT, COLON};
Expand Down Expand Up @@ -535,7 +536,7 @@ impl<'a, R: Reader> Iterator for HeaderValueByteIterator<'a, R> {
/**
* A datatype for headers.
*/
pub trait HeaderConvertible: PartialEq + Clone {
pub trait HeaderConvertible: PartialEq + Clone + Debug {
/**
* Read a header value from an iterator over the raw value.
*
Expand Down
6 changes: 3 additions & 3 deletions src/http/headers/test_utils.rs
Expand Up @@ -19,14 +19,14 @@ pub fn to_stream_into_str<T: HeaderConvertible>(v: &T) -> String {

// Verify that a value cannot be successfully interpreted as a header value of the specified type.
#[inline]
pub fn assert_invalid<T: HeaderConvertible + fmt::Show>(string: &str) {
pub fn assert_invalid<T: HeaderConvertible + fmt::Debug>(string: &str) {
assert_eq!(from_stream_with_str::<T>(string), None);
}

// Verify that all of the methods from the HeaderConvertible trait work correctly for the given
// valid header value and correct decoded value.
#[inline]
pub fn assert_conversion_correct<T: HeaderConvertible + fmt::Show>(string: &'static str, value: T) {
pub fn assert_conversion_correct<T: HeaderConvertible + fmt::Debug>(string: &'static str, value: T) {
assert_eq!(from_stream_with_str(string), Some(value.clone()));
let s = to_stream_into_str(&value);
assert_eq!(&s[], string);
Expand All @@ -36,6 +36,6 @@ pub fn assert_conversion_correct<T: HeaderConvertible + fmt::Show>(string: &'sta

// Verify that from_stream interprets the given valid header value correctly.
#[inline]
pub fn assert_interpretation_correct<T: HeaderConvertible + fmt::Show>(string: &'static str, value: T) {
pub fn assert_interpretation_correct<T: HeaderConvertible + fmt::Debug>(string: &'static str, value: T) {
assert_eq!(from_stream_with_str(string), Some(value));
}
2 changes: 1 addition & 1 deletion src/http/headers/transfer_encoding.rs
Expand Up @@ -12,7 +12,7 @@ pub use self::TransferCoding::{Chunked, TransferExtension};
///
/// transfer-coding = "chunked" | transfer-extension
/// transfer-extension = token *( ";" parameter )
#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum TransferCoding {
Chunked,
TransferExtension(String, Vec<(String, String)>),
Expand Down
4 changes: 2 additions & 2 deletions src/http/method.rs
Expand Up @@ -8,7 +8,7 @@ pub use self::Method::{Options, Get, Head, Post, Put, Delete, Trace,
/// HTTP methods, as defined in RFC 2616, §5.1.1.
///
/// Method names are case-sensitive.
#[derive(PartialEq, Eq, Clone, Hash)]
#[derive(PartialEq, Eq, Clone, Hash, Debug)]
pub enum Method {
Options,
Get,
Expand Down Expand Up @@ -49,7 +49,7 @@ impl FromStr for Method {
}
}

impl fmt::Show for Method {
impl fmt::Display for Method {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(match *self {
Options => "OPTIONS",
Expand Down
4 changes: 2 additions & 2 deletions src/http/rfc2616.rs
Expand Up @@ -176,7 +176,7 @@ pub enum ContentCoding {
// - "pack200-gzip" (Network Transfer Format for Java Archives)
}

impl fmt::Show for ContentCoding {
impl fmt::Display for ContentCoding {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(match *self {
ContentCoding::Gzip => "gzip",
Expand Down Expand Up @@ -214,7 +214,7 @@ pub enum TransferCoding {
Deflate, // See above
}

impl fmt::Show for TransferCoding {
impl fmt::Display for TransferCoding {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(match *self {
TransferCoding::Chunked => "chunked",
Expand Down
5 changes: 3 additions & 2 deletions src/http/server/request.rs
Expand Up @@ -3,6 +3,7 @@ use method::Method;
use method::Method::Options;
use status;
use status::Status::{BadRequest, RequestUriTooLong, HttpVersionNotSupported};
use std::fmt::Display;
use std::io::{Stream, IoResult};
use std::io::net::ip::SocketAddr;
use std::io::net::tcp::TcpStream;
Expand Down Expand Up @@ -260,7 +261,7 @@ pub struct Request {
}

/// The URI (Request-URI in RFC 2616) as specified in the Status-Line of an HTTP request
#[derive(PartialEq, Eq)]
#[derive(PartialEq, Eq, Debug)]
pub enum RequestUri {
/// 'The asterisk "*" means that the request does not apply to a particular resource, but to the
/// server itself, and is only allowed when the method used does not necessarily apply to a
Expand Down Expand Up @@ -313,7 +314,7 @@ impl RequestUri {
}
}

impl fmt::Show for RequestUri {
impl fmt::Display for RequestUri {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Star => f.write_str("*"),
Expand Down

0 comments on commit 53d30c0

Please sign in to comment.