(fix) Add semicolons at macro invocation sites.

This commit is contained in:
Jonathan Reem
2014-12-20 02:38:00 -08:00
parent 15bac9dadc
commit 90925f05ee
28 changed files with 76 additions and 60 deletions

View File

@@ -366,7 +366,7 @@ mod tests {
Server: mock3\r\n\ Server: mock3\r\n\
\r\n\ \r\n\
" "
}) });
#[test] #[test]
fn test_redirect_followall() { fn test_redirect_followall() {

View File

@@ -114,7 +114,7 @@ impl Request<Fresh> {
} }
debug!("writing head: {} {} {}", self.method, uri, self.version); 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)); try!(self.body.write(LINE_ENDING));

View File

@@ -23,7 +23,7 @@ use mime::Mime;
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct Accept(pub Vec<Mime>); pub struct Accept(pub Vec<Mime>);
deref!(Accept -> Vec<Mime>) deref!(Accept -> Vec<Mime>);
impl Header for Accept { impl Header for Accept {
fn header_name(_: Option<Accept>) -> &'static str { 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()] });

View File

@@ -9,7 +9,7 @@ use super::util::{from_comma_delimited, fmt_comma_delimited};
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct Allow(pub Vec<Method>); pub struct Allow(pub Vec<Method>);
deref!(Allow -> Vec<Method>) deref!(Allow -> Vec<Method>);
impl Header for Allow { impl Header for Allow {
fn header_name(_: Option<Allow>) -> &'static str { 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()] });

View File

@@ -191,5 +191,6 @@ mod tests {
} }
bench_header!(raw, Authorization<String>, { vec![b"foo bar baz".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()] }) bench_header!(basic, Authorization<Basic>, { vec![b"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==".to_vec()] });

View File

@@ -7,7 +7,7 @@ use super::util::{from_one_comma_delimited, fmt_comma_delimited};
#[deriving(PartialEq, Clone, Show)] #[deriving(PartialEq, Clone, Show)]
pub struct CacheControl(pub Vec<CacheDirective>); pub struct CacheControl(pub Vec<CacheDirective>);
deref!(CacheControl -> Vec<CacheDirective>) deref!(CacheControl -> Vec<CacheDirective>);
impl Header for CacheControl { impl Header for CacheControl {
fn header_name(_: Option<CacheControl>) -> &'static str { 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()] });

View File

@@ -9,7 +9,7 @@ pub use self::ConnectionOption::{KeepAlive, Close, ConnectionHeader};
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct Connection(pub Vec<ConnectionOption>); pub struct Connection(pub Vec<ConnectionOption>);
deref!(Connection -> Vec<ConnectionOption>) deref!(Connection -> Vec<ConnectionOption>);
/// Values that can be in the `Connection` header. /// Values that can be in the `Connection` header.
#[deriving(Clone, PartialEq)] #[deriving(Clone, PartialEq)]
@@ -66,6 +66,7 @@ impl HeaderFormat for Connection {
} }
} }
bench_header!(close, Connection, { vec![b"close".to_vec()] }) bench_header!(close, Connection, { vec![b"close".to_vec()] });
bench_header!(keep_alive, Connection, { vec![b"keep-alive".to_vec()] }) bench_header!(keep_alive, Connection, { vec![b"keep-alive".to_vec()] });
bench_header!(header, Connection, { vec![b"authorization".to_vec()] }) bench_header!(header, Connection, { vec![b"authorization".to_vec()] });

View File

@@ -9,7 +9,7 @@ use super::util::from_one_raw_str;
#[deriving(Copy, Clone, PartialEq, Show)] #[deriving(Copy, Clone, PartialEq, Show)]
pub struct ContentLength(pub uint); pub struct ContentLength(pub uint);
deref!(ContentLength -> uint) deref!(ContentLength -> uint);
impl Header for ContentLength { impl Header for ContentLength {
fn header_name(_: Option<ContentLength>) -> &'static str { 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()] });

View File

@@ -10,7 +10,7 @@ use mime::Mime;
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct ContentType(pub Mime); pub struct ContentType(pub Mime);
deref!(ContentType -> Mime) deref!(ContentType -> Mime);
impl Header for ContentType { impl Header for ContentType {
fn header_name(_: Option<ContentType>) -> &'static str { 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()] });

View File

@@ -16,7 +16,7 @@ use cookie::CookieJar;
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct Cookies(pub Vec<Cookie>); pub struct Cookies(pub Vec<Cookie>);
deref!(Cookies -> Vec<Cookie>) deref!(Cookies -> Vec<Cookie>);
impl Header for Cookies { impl Header for Cookies {
fn header_name(_: Option<Cookies>) -> &'static str { fn header_name(_: Option<Cookies>) -> &'static str {
@@ -72,7 +72,7 @@ impl Cookies {
jar jar
} }
/// Extracts all cookies from `CookieJar` and creates Cookie header. /// Extracts all cookies from `CookieJar` and creates Cookie header.
/// Useful for clients. /// Useful for clients.
pub fn from_cookie_jar(jar: &CookieJar) -> Cookies { pub fn from_cookie_jar(jar: &CookieJar) -> Cookies {
Cookies(jar.iter().collect()) 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()] });

View File

@@ -9,7 +9,7 @@ use super::util::{from_one_raw_str, tm_from_str};
#[deriving(Copy, PartialEq, Clone)] #[deriving(Copy, PartialEq, Clone)]
pub struct Date(pub Tm); pub struct Date(pub Tm);
deref!(Date -> Tm) deref!(Date -> Tm);
impl Header for Date { impl Header for Date {
fn header_name(_: Option<Date>) -> &'static str { 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!(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!(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!(asctime, Date, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });

View File

@@ -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()] });

View File

@@ -8,7 +8,7 @@ use super::util::{from_one_raw_str, tm_from_str};
#[deriving(Copy, PartialEq, Clone)] #[deriving(Copy, PartialEq, Clone)]
pub struct Expires(pub Tm); pub struct Expires(pub Tm);
deref!(Expires -> Tm) deref!(Expires -> Tm);
impl Header for Expires { impl Header for Expires {
fn header_name(_: Option<Expires>) -> &'static str { 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!(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!(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!(asctime, Expires, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });

View File

@@ -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()] });

View File

@@ -8,7 +8,7 @@ use super::util::{from_one_raw_str, tm_from_str};
#[deriving(Copy, PartialEq, Clone)] #[deriving(Copy, PartialEq, Clone)]
pub struct IfModifiedSince(pub Tm); pub struct IfModifiedSince(pub Tm);
deref!(IfModifiedSince -> Tm) deref!(IfModifiedSince -> Tm);
impl Header for IfModifiedSince { impl Header for IfModifiedSince {
fn header_name(_: Option<IfModifiedSince>) -> &'static str { 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!(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!(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!(asctime, IfModifiedSince, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });

View File

@@ -8,7 +8,7 @@ use super::util::{from_one_raw_str, tm_from_str};
#[deriving(Copy, PartialEq, Clone)] #[deriving(Copy, PartialEq, Clone)]
pub struct LastModified(pub Tm); pub struct LastModified(pub Tm);
deref!(LastModified -> Tm) deref!(LastModified -> Tm);
impl Header for LastModified { impl Header for LastModified {
fn header_name(_: Option<LastModified>) -> &'static str { 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!(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!(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!(asctime, LastModified, { vec![b"Sun Nov 6 08:49:37 1994".to_vec()] });

View File

@@ -16,7 +16,7 @@ use super::util::from_one_raw_str;
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct Location(pub String); pub struct Location(pub String);
deref!(Location -> String) deref!(Location -> String);
impl Header for Location { impl Header for Location {
fn header_name(_: Option<Location>) -> &'static str { 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()] });

View File

@@ -55,7 +55,7 @@ macro_rules! bench_header(
} }
} }
} }
) );
macro_rules! deref( macro_rules! deref(
($from:ty -> $to:ty) => { ($from:ty -> $to:ty) => {
@@ -71,7 +71,7 @@ macro_rules! deref(
} }
} }
} }
) );
/// Exposes the Accept header. /// Exposes the Accept header.
pub mod accept; pub mod accept;

View File

@@ -8,7 +8,7 @@ use super::util::from_one_raw_str;
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct Server(pub String); pub struct Server(pub String);
deref!(Server -> String) deref!(Server -> String);
impl Header for Server { impl Header for Server {
fn header_name(_: Option<Server>) -> &'static str { 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()] });

View File

@@ -13,7 +13,7 @@ use cookie::CookieJar;
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct SetCookie(pub Vec<Cookie>); pub struct SetCookie(pub Vec<Cookie>);
deref!(SetCookie -> Vec<Cookie>) deref!(SetCookie -> Vec<Cookie>);
impl Header for SetCookie { impl Header for SetCookie {
fn header_name(_: Option<SetCookie>) -> &'static str { 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.encrypted().find("foo"), new_jar.encrypted().find("foo"));
assert_eq!(jar.iter().collect::<Vec<Cookie>>(), new_jar.iter().collect::<Vec<Cookie>>()); assert_eq!(jar.iter().collect::<Vec<Cookie>>(), new_jar.iter().collect::<Vec<Cookie>>());
} }

View File

@@ -21,7 +21,7 @@ use self::Encoding::{Chunked, Gzip, Deflate, Compress, EncodingExt};
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct TransferEncoding(pub Vec<Encoding>); pub struct TransferEncoding(pub Vec<Encoding>);
deref!(TransferEncoding -> Vec<Encoding>) deref!(TransferEncoding -> Vec<Encoding>);
/// A value to be used with the `Transfer-Encoding` header. /// 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!(normal, TransferEncoding, { vec![b"chunked, gzip".to_vec()] });
bench_header!(ext, TransferEncoding, { vec![b"ext".to_vec()] }) bench_header!(ext, TransferEncoding, { vec![b"ext".to_vec()] });

View File

@@ -9,7 +9,7 @@ use self::Protocol::{WebSocket, ProtocolExt};
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct Upgrade(pub Vec<Protocol>); pub struct Upgrade(pub Vec<Protocol>);
deref!(Upgrade -> Vec<Protocol>) deref!(Upgrade -> Vec<Protocol>);
/// Protocol values that can appear in the Upgrade header. /// Protocol values that can appear in the Upgrade header.
#[deriving(Clone, PartialEq)] #[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()] });

View File

@@ -8,7 +8,7 @@ use super::util::from_one_raw_str;
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct UserAgent(pub String); pub struct UserAgent(pub String);
deref!(UserAgent -> String) deref!(UserAgent -> String);
impl Header for UserAgent { impl Header for UserAgent {
fn header_name(_: Option<UserAgent>) -> &'static str { 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()] });

View File

@@ -458,7 +458,7 @@ impl FromStr for CaseInsensitive {
impl Clone for CaseInsensitive { impl Clone for CaseInsensitive {
fn clone(&self) -> CaseInsensitive { fn clone(&self) -> CaseInsensitive {
CaseInsensitive((*self.0).clone().into_cow()) CaseInsensitive(self.0.clone().into_cow())
} }
} }

View File

@@ -156,7 +156,7 @@ macro_rules! todo(
($($arg:tt)*) => (if cfg!(not(ndebug)) { ($($arg:tt)*) => (if cfg!(not(ndebug)) {
format_args!(|args| log!(5, "TODO: {}", args), $($arg)*) format_args!(|args| log!(5, "TODO: {}", args), $($arg)*)
}) })
) );
#[allow(dead_code)] #[allow(dead_code)]
struct Trace; struct Trace;
@@ -172,7 +172,7 @@ macro_rules! trace(
($($arg:tt)*) => (if cfg!(not(ndebug)) { ($($arg:tt)*) => (if cfg!(not(ndebug)) {
format_args!(|args| log!(5, "{}\n{}", args, ::Trace), $($arg)*) format_args!(|args| log!(5, "{}\n{}", args, ::Trace), $($arg)*)
}) })
) );
macro_rules! inspect( macro_rules! inspect(
($name:expr, $value:expr) => ({ ($name:expr, $value:expr) => ({
@@ -180,7 +180,7 @@ macro_rules! inspect(
debug!("inspect: {} = {}", $name, v); debug!("inspect: {} = {}", $name, v);
v v
}) })
) );
#[cfg(test)] #[cfg(test)]
#[macro_escape] #[macro_escape]

View File

@@ -104,4 +104,5 @@ macro_rules! mock_connector (
} }
) )
) );

View File

@@ -38,7 +38,7 @@ macro_rules! try_option(
None => return None None => return None
} }
}} }}
) );
impl Server<HttpListener> { impl Server<HttpListener> {
/// Creates a new server that will handle `HttpStream`s. /// Creates a new server that will handle `HttpStream`s.

View File

@@ -80,7 +80,7 @@ mod tests {
macro_rules! sock( macro_rules! sock(
($s:expr) => (::std::str::from_str::<::std::io::net::ip::SocketAddr>($s).unwrap()) ($s:expr) => (::std::str::from_str::<::std::io::net::ip::SocketAddr>($s).unwrap())
) );
#[test] #[test]
fn test_get_empty_body() { fn test_get_empty_body() {