More Rust updates:
- Some stray deriving -> derive changes
- use::{mod} -> use::{self}
- fmt.write -> fmt.write_str
This does not catch the last case of fmt.write_str in the
Show impl of a Header Item. This will need to be changed
separately.
This commit is contained in:
@@ -7,7 +7,7 @@ use header::shared;
|
||||
///
|
||||
/// The `Accept-Encoding` header can be used by clients to indicate what
|
||||
/// response encodings they accept.
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[derive(Clone, PartialEq, Show)]
|
||||
pub struct AcceptEncoding(pub Vec<shared::QualityItem<shared::Encoding>>);
|
||||
|
||||
deref!(AcceptEncoding -> Vec<shared::QualityItem<shared::Encoding>>);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use method::Method;
|
||||
use std::fmt::{mod};
|
||||
use std::fmt::{self};
|
||||
use header::shared::util::{from_comma_delimited, fmt_comma_delimited};
|
||||
|
||||
/// The `Allow` header.
|
||||
@@ -31,7 +31,7 @@ impl HeaderFormat for Allow {
|
||||
mod tests {
|
||||
use super::Allow;
|
||||
use header::Header;
|
||||
use method::Method::{mod, Options, Get, Put, Post, Delete, Head, Trace, Connect, Patch, Extension};
|
||||
use method::Method::{self, Options, Get, Put, Post, Delete, Head, Trace, Connect, Patch, Extension};
|
||||
|
||||
#[test]
|
||||
fn test_allow() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use std::str::{FromStr, from_utf8};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use serialize::base64::{ToBase64, FromBase64, Standard, Config, Newline};
|
||||
use header::{Header, HeaderFormat};
|
||||
|
||||
@@ -7,13 +8,15 @@ use header::{Header, HeaderFormat};
|
||||
#[derive(Clone, PartialEq, Show)]
|
||||
pub struct Authorization<S: Scheme>(pub S);
|
||||
|
||||
impl<S: Scheme> Deref<S> for Authorization<S> {
|
||||
impl<S: Scheme> Deref for Authorization<S> {
|
||||
type Target = S;
|
||||
|
||||
fn deref<'a>(&'a self) -> &'a S {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: Scheme> DerefMut<S> for Authorization<S> {
|
||||
impl<S: Scheme> DerefMut for Authorization<S> {
|
||||
fn deref_mut<'a>(&'a mut self) -> &'a mut S {
|
||||
&mut self.0
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use std::str::FromStr;
|
||||
use header::shared::util::{from_comma_delimited, fmt_comma_delimited};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
|
||||
use header::{Header, HeaderFormat};
|
||||
use header::shared::util::from_one_raw_str;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use header::shared::util::from_one_raw_str;
|
||||
use mime::Mime;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use std::str::from_utf8;
|
||||
|
||||
use cookie::Cookie;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use std::str::FromStr;
|
||||
use time::Tm;
|
||||
use header::{Header, HeaderFormat};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use std::fmt::{mod};
|
||||
use std::fmt::{self};
|
||||
use header::shared::util::from_one_raw_str;
|
||||
|
||||
/// The `Etag` header.
|
||||
@@ -81,7 +81,7 @@ impl Header for Etag {
|
||||
impl HeaderFormat for Etag {
|
||||
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
if self.weak {
|
||||
try!(fmt.write(b"W/"));
|
||||
try!(fmt.write_str("W/"));
|
||||
}
|
||||
write!(fmt, "\"{}\"", self.tag)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use std::str::FromStr;
|
||||
use time::Tm;
|
||||
use header::{Header, HeaderFormat};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use Port;
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use header::shared::util::from_one_raw_str;
|
||||
|
||||
/// The `Host` header.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use std::str::FromStr;
|
||||
use time::Tm;
|
||||
use header::{Header, HeaderFormat};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use std::str::FromStr;
|
||||
use time::Tm;
|
||||
use header::{Header, HeaderFormat};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use header::shared::util::from_one_raw_str;
|
||||
|
||||
/// The `Location` header.
|
||||
|
||||
@@ -60,13 +60,15 @@ macro_rules! bench_header(
|
||||
|
||||
macro_rules! deref(
|
||||
($from:ty -> $to:ty) => {
|
||||
impl Deref<$to> for $from {
|
||||
impl ::std::ops::Deref for $from {
|
||||
type Target = $to;
|
||||
|
||||
fn deref<'a>(&'a self) -> &'a $to {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut<$to> for $from {
|
||||
impl ::std::ops::DerefMut for $from {
|
||||
fn deref_mut<'a>(&'a mut self) -> &'a mut $to {
|
||||
&mut self.0
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use header::shared::util::from_one_raw_str;
|
||||
|
||||
/// The `Server` header field.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use std::str::from_utf8;
|
||||
|
||||
use cookie::Cookie;
|
||||
@@ -52,7 +52,7 @@ impl HeaderFormat for SetCookie {
|
||||
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
for (i, cookie) in self.0.iter().enumerate() {
|
||||
if i != 0 {
|
||||
try!(f.write(b"\r\nSet-Cookie: "));
|
||||
try!(f.write_str("\r\nSet-Cookie: "));
|
||||
}
|
||||
try!(cookie.fmt(f));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use std::str::FromStr;
|
||||
use header::shared::util::{from_comma_delimited, fmt_comma_delimited};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat};
|
||||
use std::fmt::{mod, Show};
|
||||
use std::fmt::{self, Show};
|
||||
use header::shared::util::from_one_raw_str;
|
||||
|
||||
/// The `User-Agent` header field.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use header::{Header, HeaderFormat, CaseInsensitive};
|
||||
use std::fmt::{mod};
|
||||
use std::fmt::{self};
|
||||
use header::shared::util::{from_comma_delimited, fmt_comma_delimited, from_one_raw_str};
|
||||
|
||||
/// The `Allow` header.
|
||||
|
||||
Reference in New Issue
Block a user