(fix) Add semicolons at macro invocation sites.
This commit is contained in:
@@ -366,7 +366,7 @@ mod tests {
|
||||
Server: mock3\r\n\
|
||||
\r\n\
|
||||
"
|
||||
})
|
||||
});
|
||||
|
||||
#[test]
|
||||
fn test_redirect_followall() {
|
||||
|
||||
@@ -114,7 +114,7 @@ impl Request<Fresh> {
|
||||
}
|
||||
|
||||
debug!("writing head: {} {} {}", self.method, uri, self.version);
|
||||
try!(write!(&mut self.body, "{} {} {}", self.method, uri, self.version))
|
||||
try!(write!(&mut self.body, "{} {} {}", self.method, uri, self.version));
|
||||
try!(self.body.write(LINE_ENDING));
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ use mime::Mime;
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct Accept(pub Vec<Mime>);
|
||||
|
||||
deref!(Accept -> Vec<Mime>)
|
||||
deref!(Accept -> Vec<Mime>);
|
||||
|
||||
impl Header for Accept {
|
||||
fn header_name(_: Option<Accept>) -> &'static str {
|
||||
@@ -69,5 +69,5 @@ impl HeaderFormat for Accept {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, Accept, { vec![b"text/plain; q=0.5, text/html".to_vec()] })
|
||||
bench_header!(bench, Accept, { vec![b"text/plain; q=0.5, text/html".to_vec()] });
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use super::util::{from_comma_delimited, fmt_comma_delimited};
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct Allow(pub Vec<Method>);
|
||||
|
||||
deref!(Allow -> Vec<Method>)
|
||||
deref!(Allow -> Vec<Method>);
|
||||
|
||||
impl Header for Allow {
|
||||
fn header_name(_: Option<Allow>) -> &'static str {
|
||||
@@ -45,4 +45,5 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, Allow, { vec![b"OPTIONS,GET,PUT,POST,DELETE,HEAD,TRACE,CONNECT,PATCH,fOObAr".to_vec()] })
|
||||
bench_header!(bench, Allow, { vec![b"OPTIONS,GET,PUT,POST,DELETE,HEAD,TRACE,CONNECT,PATCH,fOObAr".to_vec()] });
|
||||
|
||||
|
||||
@@ -191,5 +191,6 @@ mod tests {
|
||||
|
||||
}
|
||||
|
||||
bench_header!(raw, Authorization<String>, { vec![b"foo bar baz".to_vec()] })
|
||||
bench_header!(basic, Authorization<Basic>, { vec![b"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==".to_vec()] })
|
||||
bench_header!(raw, Authorization<String>, { vec![b"foo bar baz".to_vec()] });
|
||||
bench_header!(basic, Authorization<Basic>, { vec![b"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==".to_vec()] });
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use super::util::{from_one_comma_delimited, fmt_comma_delimited};
|
||||
#[deriving(PartialEq, Clone, Show)]
|
||||
pub struct CacheControl(pub Vec<CacheDirective>);
|
||||
|
||||
deref!(CacheControl -> Vec<CacheDirective>)
|
||||
deref!(CacheControl -> Vec<CacheDirective>);
|
||||
|
||||
impl Header for CacheControl {
|
||||
fn header_name(_: Option<CacheControl>) -> &'static str {
|
||||
@@ -162,4 +162,5 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(normal, CacheControl, { vec![b"no-cache, private".to_vec(), b"max-age=100".to_vec()] })
|
||||
bench_header!(normal, CacheControl, { vec![b"no-cache, private".to_vec(), b"max-age=100".to_vec()] });
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ pub use self::ConnectionOption::{KeepAlive, Close, ConnectionHeader};
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct Connection(pub Vec<ConnectionOption>);
|
||||
|
||||
deref!(Connection -> Vec<ConnectionOption>)
|
||||
deref!(Connection -> Vec<ConnectionOption>);
|
||||
|
||||
/// Values that can be in the `Connection` header.
|
||||
#[deriving(Clone, PartialEq)]
|
||||
@@ -66,6 +66,7 @@ impl HeaderFormat for Connection {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(close, Connection, { vec![b"close".to_vec()] })
|
||||
bench_header!(keep_alive, Connection, { vec![b"keep-alive".to_vec()] })
|
||||
bench_header!(header, Connection, { vec![b"authorization".to_vec()] })
|
||||
bench_header!(close, Connection, { vec![b"close".to_vec()] });
|
||||
bench_header!(keep_alive, Connection, { vec![b"keep-alive".to_vec()] });
|
||||
bench_header!(header, Connection, { vec![b"authorization".to_vec()] });
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use super::util::from_one_raw_str;
|
||||
#[deriving(Copy, Clone, PartialEq, Show)]
|
||||
pub struct ContentLength(pub uint);
|
||||
|
||||
deref!(ContentLength -> uint)
|
||||
deref!(ContentLength -> uint);
|
||||
|
||||
impl Header for ContentLength {
|
||||
fn header_name(_: Option<ContentLength>) -> &'static str {
|
||||
@@ -37,4 +37,5 @@ impl ContentLength {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, ContentLength, { vec![b"42349984".to_vec()] })
|
||||
bench_header!(bench, ContentLength, { vec![b"42349984".to_vec()] });
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use mime::Mime;
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct ContentType(pub Mime);
|
||||
|
||||
deref!(ContentType -> Mime)
|
||||
deref!(ContentType -> Mime);
|
||||
|
||||
impl Header for ContentType {
|
||||
fn header_name(_: Option<ContentType>) -> &'static str {
|
||||
@@ -29,4 +29,5 @@ impl HeaderFormat for ContentType {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, ContentType, { vec![b"application/json; charset=utf-8".to_vec()] })
|
||||
bench_header!(bench, ContentType, { vec![b"application/json; charset=utf-8".to_vec()] });
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ use cookie::CookieJar;
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct Cookies(pub Vec<Cookie>);
|
||||
|
||||
deref!(Cookies -> Vec<Cookie>)
|
||||
deref!(Cookies -> Vec<Cookie>);
|
||||
|
||||
impl Header for Cookies {
|
||||
fn header_name(_: Option<Cookies>) -> &'static str {
|
||||
@@ -72,7 +72,7 @@ impl Cookies {
|
||||
jar
|
||||
}
|
||||
|
||||
/// Extracts all cookies from `CookieJar` and creates Cookie header.
|
||||
/// Extracts all cookies from `CookieJar` and creates Cookie header.
|
||||
/// Useful for clients.
|
||||
pub fn from_cookie_jar(jar: &CookieJar) -> Cookies {
|
||||
Cookies(jar.iter().collect())
|
||||
@@ -113,4 +113,5 @@ fn cookie_jar() {
|
||||
}
|
||||
|
||||
|
||||
bench_header!(bench, Cookies, { vec![b"foo=bar; baz=quux".to_vec()] })
|
||||
bench_header!(bench, Cookies, { vec![b"foo=bar; baz=quux".to_vec()] });
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use super::util::{from_one_raw_str, tm_from_str};
|
||||
#[deriving(Copy, PartialEq, Clone)]
|
||||
pub struct Date(pub Tm);
|
||||
|
||||
deref!(Date -> Tm)
|
||||
deref!(Date -> Tm);
|
||||
|
||||
impl Header for Date {
|
||||
fn header_name(_: Option<Date>) -> &'static str {
|
||||
@@ -38,6 +38,7 @@ impl FromStr for Date {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(imf_fixdate, Date, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] })
|
||||
bench_header!(rfc_850, Date, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] })
|
||||
bench_header!(asctime, Date, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] })
|
||||
bench_header!(imf_fixdate, Date, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
|
||||
bench_header!(rfc_850, Date, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
|
||||
bench_header!(asctime, Date, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });
|
||||
|
||||
|
||||
@@ -153,4 +153,5 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, Etag, { vec![b"W/\"nonemptytag\"".to_vec()] })
|
||||
bench_header!(bench, Etag, { vec![b"W/\"nonemptytag\"".to_vec()] });
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::util::{from_one_raw_str, tm_from_str};
|
||||
#[deriving(Copy, PartialEq, Clone)]
|
||||
pub struct Expires(pub Tm);
|
||||
|
||||
deref!(Expires -> Tm)
|
||||
deref!(Expires -> Tm);
|
||||
|
||||
impl Header for Expires {
|
||||
fn header_name(_: Option<Expires>) -> &'static str {
|
||||
@@ -37,6 +37,7 @@ impl FromStr for Expires {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(imf_fixdate, Expires, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] })
|
||||
bench_header!(rfc_850, Expires, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] })
|
||||
bench_header!(asctime, Expires, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] })
|
||||
bench_header!(imf_fixdate, Expires, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
|
||||
bench_header!(rfc_850, Expires, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
|
||||
bench_header!(asctime, Expires, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });
|
||||
|
||||
|
||||
@@ -95,5 +95,5 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, Host, { vec![b"foo.com:3000".to_vec()] })
|
||||
bench_header!(bench, Host, { vec![b"foo.com:3000".to_vec()] });
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::util::{from_one_raw_str, tm_from_str};
|
||||
#[deriving(Copy, PartialEq, Clone)]
|
||||
pub struct IfModifiedSince(pub Tm);
|
||||
|
||||
deref!(IfModifiedSince -> Tm)
|
||||
deref!(IfModifiedSince -> Tm);
|
||||
|
||||
impl Header for IfModifiedSince {
|
||||
fn header_name(_: Option<IfModifiedSince>) -> &'static str {
|
||||
@@ -37,6 +37,7 @@ impl FromStr for IfModifiedSince {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(imf_fixdate, IfModifiedSince, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] })
|
||||
bench_header!(rfc_850, IfModifiedSince, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] })
|
||||
bench_header!(asctime, IfModifiedSince, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] })
|
||||
bench_header!(imf_fixdate, IfModifiedSince, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
|
||||
bench_header!(rfc_850, IfModifiedSince, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
|
||||
bench_header!(asctime, IfModifiedSince, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::util::{from_one_raw_str, tm_from_str};
|
||||
#[deriving(Copy, PartialEq, Clone)]
|
||||
pub struct LastModified(pub Tm);
|
||||
|
||||
deref!(LastModified -> Tm)
|
||||
deref!(LastModified -> Tm);
|
||||
|
||||
impl Header for LastModified {
|
||||
fn header_name(_: Option<LastModified>) -> &'static str {
|
||||
@@ -37,6 +37,7 @@ impl FromStr for LastModified {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(imf_fixdate, LastModified, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] })
|
||||
bench_header!(rfc_850, LastModified, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] })
|
||||
bench_header!(asctime, LastModified, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] })
|
||||
bench_header!(imf_fixdate, LastModified, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
|
||||
bench_header!(rfc_850, LastModified, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
|
||||
bench_header!(asctime, LastModified, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ use super::util::from_one_raw_str;
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct Location(pub String);
|
||||
|
||||
deref!(Location -> String)
|
||||
deref!(Location -> String);
|
||||
|
||||
impl Header for Location {
|
||||
fn header_name(_: Option<Location>) -> &'static str {
|
||||
@@ -35,5 +35,5 @@ impl HeaderFormat for Location {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, Location, { vec![b"http://foo.com/hello:3000".to_vec()] })
|
||||
bench_header!(bench, Location, { vec![b"http://foo.com/hello:3000".to_vec()] });
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ macro_rules! bench_header(
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
macro_rules! deref(
|
||||
($from:ty -> $to:ty) => {
|
||||
@@ -71,7 +71,7 @@ macro_rules! deref(
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
/// Exposes the Accept header.
|
||||
pub mod accept;
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::util::from_one_raw_str;
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct Server(pub String);
|
||||
|
||||
deref!(Server -> String)
|
||||
deref!(Server -> String);
|
||||
|
||||
impl Header for Server {
|
||||
fn header_name(_: Option<Server>) -> &'static str {
|
||||
@@ -27,5 +27,5 @@ impl HeaderFormat for Server {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, Server, { vec![b"Some String".to_vec()] })
|
||||
bench_header!(bench, Server, { vec![b"Some String".to_vec()] });
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ use cookie::CookieJar;
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct SetCookie(pub Vec<Cookie>);
|
||||
|
||||
deref!(SetCookie -> Vec<Cookie>)
|
||||
deref!(SetCookie -> Vec<Cookie>);
|
||||
|
||||
impl Header for SetCookie {
|
||||
fn header_name(_: Option<SetCookie>) -> &'static str {
|
||||
@@ -111,3 +111,4 @@ fn cookie_jar() {
|
||||
assert_eq!(jar.encrypted().find("foo"), new_jar.encrypted().find("foo"));
|
||||
assert_eq!(jar.iter().collect::<Vec<Cookie>>(), new_jar.iter().collect::<Vec<Cookie>>());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ use self::Encoding::{Chunked, Gzip, Deflate, Compress, EncodingExt};
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct TransferEncoding(pub Vec<Encoding>);
|
||||
|
||||
deref!(TransferEncoding -> Vec<Encoding>)
|
||||
deref!(TransferEncoding -> Vec<Encoding>);
|
||||
|
||||
/// A value to be used with the `Transfer-Encoding` header.
|
||||
///
|
||||
@@ -87,5 +87,6 @@ impl HeaderFormat for TransferEncoding {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(normal, TransferEncoding, { vec![b"chunked, gzip".to_vec()] })
|
||||
bench_header!(ext, TransferEncoding, { vec![b"ext".to_vec()] })
|
||||
bench_header!(normal, TransferEncoding, { vec![b"chunked, gzip".to_vec()] });
|
||||
bench_header!(ext, TransferEncoding, { vec![b"ext".to_vec()] });
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use self::Protocol::{WebSocket, ProtocolExt};
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct Upgrade(pub Vec<Protocol>);
|
||||
|
||||
deref!(Upgrade -> Vec<Protocol>)
|
||||
deref!(Upgrade -> Vec<Protocol>);
|
||||
|
||||
/// Protocol values that can appear in the Upgrade header.
|
||||
#[deriving(Clone, PartialEq)]
|
||||
@@ -55,4 +55,5 @@ impl HeaderFormat for Upgrade {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, Upgrade, { vec![b"HTTP/2.0, RTA/x11, websocket".to_vec()] })
|
||||
bench_header!(bench, Upgrade, { vec![b"HTTP/2.0, RTA/x11, websocket".to_vec()] });
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::util::from_one_raw_str;
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub struct UserAgent(pub String);
|
||||
|
||||
deref!(UserAgent -> String)
|
||||
deref!(UserAgent -> String);
|
||||
|
||||
impl Header for UserAgent {
|
||||
fn header_name(_: Option<UserAgent>) -> &'static str {
|
||||
@@ -27,5 +27,5 @@ impl HeaderFormat for UserAgent {
|
||||
}
|
||||
}
|
||||
|
||||
bench_header!(bench, UserAgent, { vec![b"cargo bench".to_vec()] })
|
||||
bench_header!(bench, UserAgent, { vec![b"cargo bench".to_vec()] });
|
||||
|
||||
|
||||
@@ -458,7 +458,7 @@ impl FromStr for CaseInsensitive {
|
||||
|
||||
impl Clone for CaseInsensitive {
|
||||
fn clone(&self) -> CaseInsensitive {
|
||||
CaseInsensitive((*self.0).clone().into_cow())
|
||||
CaseInsensitive(self.0.clone().into_cow())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ macro_rules! todo(
|
||||
($($arg:tt)*) => (if cfg!(not(ndebug)) {
|
||||
format_args!(|args| log!(5, "TODO: {}", args), $($arg)*)
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
#[allow(dead_code)]
|
||||
struct Trace;
|
||||
@@ -172,7 +172,7 @@ macro_rules! trace(
|
||||
($($arg:tt)*) => (if cfg!(not(ndebug)) {
|
||||
format_args!(|args| log!(5, "{}\n{}", args, ::Trace), $($arg)*)
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
macro_rules! inspect(
|
||||
($name:expr, $value:expr) => ({
|
||||
@@ -180,7 +180,7 @@ macro_rules! inspect(
|
||||
debug!("inspect: {} = {}", $name, v);
|
||||
v
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_escape]
|
||||
|
||||
@@ -104,4 +104,5 @@ macro_rules! mock_connector (
|
||||
}
|
||||
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ macro_rules! try_option(
|
||||
None => return None
|
||||
}
|
||||
}}
|
||||
)
|
||||
);
|
||||
|
||||
impl Server<HttpListener> {
|
||||
/// Creates a new server that will handle `HttpStream`s.
|
||||
|
||||
@@ -80,7 +80,7 @@ mod tests {
|
||||
|
||||
macro_rules! sock(
|
||||
($s:expr) => (::std::str::from_str::<::std::io::net::ip::SocketAddr>($s).unwrap())
|
||||
)
|
||||
);
|
||||
|
||||
#[test]
|
||||
fn test_get_empty_body() {
|
||||
|
||||
Reference in New Issue
Block a user