From 90925f05ee5c2488332fcd158f7220b871aabd4d Mon Sep 17 00:00:00 2001 From: Jonathan Reem Date: Sat, 20 Dec 2014 02:38:00 -0800 Subject: [PATCH] (fix) Add semicolons at macro invocation sites. --- src/client/mod.rs | 2 +- src/client/request.rs | 2 +- src/header/common/accept.rs | 4 ++-- src/header/common/allow.rs | 5 +++-- src/header/common/authorization.rs | 5 +++-- src/header/common/cache_control.rs | 5 +++-- src/header/common/connection.rs | 9 +++++---- src/header/common/content_length.rs | 5 +++-- src/header/common/content_type.rs | 5 +++-- src/header/common/cookie.rs | 7 ++++--- src/header/common/date.rs | 9 +++++---- src/header/common/etag.rs | 3 ++- src/header/common/expires.rs | 9 +++++---- src/header/common/host.rs | 2 +- src/header/common/if_modified_since.rs | 9 +++++---- src/header/common/last_modified.rs | 9 +++++---- src/header/common/location.rs | 4 ++-- src/header/common/mod.rs | 4 ++-- src/header/common/server.rs | 4 ++-- src/header/common/set_cookie.rs | 3 ++- src/header/common/transfer_encoding.rs | 7 ++++--- src/header/common/upgrade.rs | 5 +++-- src/header/common/user_agent.rs | 4 ++-- src/header/mod.rs | 2 +- src/lib.rs | 6 +++--- src/mock.rs | 3 ++- src/server/mod.rs | 2 +- src/server/request.rs | 2 +- 28 files changed, 76 insertions(+), 60 deletions(-) diff --git a/src/client/mod.rs b/src/client/mod.rs index 36fb6284..eccb2617 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -366,7 +366,7 @@ mod tests { Server: mock3\r\n\ \r\n\ " - }) + }); #[test] fn test_redirect_followall() { diff --git a/src/client/request.rs b/src/client/request.rs index ff1fa9c1..6787e86b 100644 --- a/src/client/request.rs +++ b/src/client/request.rs @@ -114,7 +114,7 @@ impl Request { } 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)); diff --git a/src/header/common/accept.rs b/src/header/common/accept.rs index 13d91142..3080ebbd 100644 --- a/src/header/common/accept.rs +++ b/src/header/common/accept.rs @@ -23,7 +23,7 @@ use mime::Mime; #[deriving(Clone, PartialEq, Show)] pub struct Accept(pub Vec); -deref!(Accept -> Vec) +deref!(Accept -> Vec); impl Header for Accept { fn header_name(_: Option) -> &'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()] }); diff --git a/src/header/common/allow.rs b/src/header/common/allow.rs index 41489adb..07e17cd2 100644 --- a/src/header/common/allow.rs +++ b/src/header/common/allow.rs @@ -9,7 +9,7 @@ use super::util::{from_comma_delimited, fmt_comma_delimited}; #[deriving(Clone, PartialEq, Show)] pub struct Allow(pub Vec); -deref!(Allow -> Vec) +deref!(Allow -> Vec); impl Header for Allow { fn header_name(_: Option) -> &'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()] }) \ No newline at end of file +bench_header!(bench, Allow, { vec![b"OPTIONS,GET,PUT,POST,DELETE,HEAD,TRACE,CONNECT,PATCH,fOObAr".to_vec()] }); + diff --git a/src/header/common/authorization.rs b/src/header/common/authorization.rs index fe370c5d..b6708b95 100644 --- a/src/header/common/authorization.rs +++ b/src/header/common/authorization.rs @@ -191,5 +191,6 @@ mod tests { } -bench_header!(raw, Authorization, { vec![b"foo bar baz".to_vec()] }) -bench_header!(basic, Authorization, { vec![b"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==".to_vec()] }) +bench_header!(raw, Authorization, { vec![b"foo bar baz".to_vec()] }); +bench_header!(basic, Authorization, { vec![b"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==".to_vec()] }); + diff --git a/src/header/common/cache_control.rs b/src/header/common/cache_control.rs index f4563d49..1844c82b 100644 --- a/src/header/common/cache_control.rs +++ b/src/header/common/cache_control.rs @@ -7,7 +7,7 @@ use super::util::{from_one_comma_delimited, fmt_comma_delimited}; #[deriving(PartialEq, Clone, Show)] pub struct CacheControl(pub Vec); -deref!(CacheControl -> Vec) +deref!(CacheControl -> Vec); impl Header for CacheControl { fn header_name(_: Option) -> &'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()] }); + diff --git a/src/header/common/connection.rs b/src/header/common/connection.rs index 2357aa12..2ae9b972 100644 --- a/src/header/common/connection.rs +++ b/src/header/common/connection.rs @@ -9,7 +9,7 @@ pub use self::ConnectionOption::{KeepAlive, Close, ConnectionHeader}; #[deriving(Clone, PartialEq, Show)] pub struct Connection(pub Vec); -deref!(Connection -> Vec) +deref!(Connection -> Vec); /// 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()] }); + diff --git a/src/header/common/content_length.rs b/src/header/common/content_length.rs index 677c8d3c..32957b97 100644 --- a/src/header/common/content_length.rs +++ b/src/header/common/content_length.rs @@ -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) -> &'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()] }); + diff --git a/src/header/common/content_type.rs b/src/header/common/content_type.rs index 5b786516..4b26dac5 100644 --- a/src/header/common/content_type.rs +++ b/src/header/common/content_type.rs @@ -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) -> &'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()] }); + diff --git a/src/header/common/cookie.rs b/src/header/common/cookie.rs index 8e8cbd8d..a4717995 100644 --- a/src/header/common/cookie.rs +++ b/src/header/common/cookie.rs @@ -16,7 +16,7 @@ use cookie::CookieJar; #[deriving(Clone, PartialEq, Show)] pub struct Cookies(pub Vec); -deref!(Cookies -> Vec) +deref!(Cookies -> Vec); impl Header for Cookies { fn header_name(_: Option) -> &'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()] }); + diff --git a/src/header/common/date.rs b/src/header/common/date.rs index 928a55c1..a33d16a4 100644 --- a/src/header/common/date.rs +++ b/src/header/common/date.rs @@ -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) -> &'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()] }); + diff --git a/src/header/common/etag.rs b/src/header/common/etag.rs index f98a65af..74a355d3 100644 --- a/src/header/common/etag.rs +++ b/src/header/common/etag.rs @@ -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()] }); + diff --git a/src/header/common/expires.rs b/src/header/common/expires.rs index 968ec023..f9dfe35c 100644 --- a/src/header/common/expires.rs +++ b/src/header/common/expires.rs @@ -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) -> &'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()] }); + diff --git a/src/header/common/host.rs b/src/header/common/host.rs index f4753996..dd1554e9 100644 --- a/src/header/common/host.rs +++ b/src/header/common/host.rs @@ -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()] }); diff --git a/src/header/common/if_modified_since.rs b/src/header/common/if_modified_since.rs index 7524cd52..850e3dff 100644 --- a/src/header/common/if_modified_since.rs +++ b/src/header/common/if_modified_since.rs @@ -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) -> &'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()] }); + diff --git a/src/header/common/last_modified.rs b/src/header/common/last_modified.rs index 0b43fe1f..5606f093 100644 --- a/src/header/common/last_modified.rs +++ b/src/header/common/last_modified.rs @@ -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) -> &'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()] }); + diff --git a/src/header/common/location.rs b/src/header/common/location.rs index 0aa3f8a4..ea3b815d 100644 --- a/src/header/common/location.rs +++ b/src/header/common/location.rs @@ -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) -> &'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()] }); diff --git a/src/header/common/mod.rs b/src/header/common/mod.rs index f26f6fb1..bbb4d37e 100644 --- a/src/header/common/mod.rs +++ b/src/header/common/mod.rs @@ -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; diff --git a/src/header/common/server.rs b/src/header/common/server.rs index 0b4085af..64c3ca1d 100644 --- a/src/header/common/server.rs +++ b/src/header/common/server.rs @@ -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) -> &'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()] }); diff --git a/src/header/common/set_cookie.rs b/src/header/common/set_cookie.rs index 033445ff..aee732d1 100644 --- a/src/header/common/set_cookie.rs +++ b/src/header/common/set_cookie.rs @@ -13,7 +13,7 @@ use cookie::CookieJar; #[deriving(Clone, PartialEq, Show)] pub struct SetCookie(pub Vec); -deref!(SetCookie -> Vec) +deref!(SetCookie -> Vec); impl Header for SetCookie { fn header_name(_: Option) -> &'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::>(), new_jar.iter().collect::>()); } + diff --git a/src/header/common/transfer_encoding.rs b/src/header/common/transfer_encoding.rs index e86f5b38..e0572cf0 100644 --- a/src/header/common/transfer_encoding.rs +++ b/src/header/common/transfer_encoding.rs @@ -21,7 +21,7 @@ use self::Encoding::{Chunked, Gzip, Deflate, Compress, EncodingExt}; #[deriving(Clone, PartialEq, Show)] pub struct TransferEncoding(pub Vec); -deref!(TransferEncoding -> Vec) +deref!(TransferEncoding -> Vec); /// 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()] }); + diff --git a/src/header/common/upgrade.rs b/src/header/common/upgrade.rs index 4083c84d..296478b8 100644 --- a/src/header/common/upgrade.rs +++ b/src/header/common/upgrade.rs @@ -9,7 +9,7 @@ use self::Protocol::{WebSocket, ProtocolExt}; #[deriving(Clone, PartialEq, Show)] pub struct Upgrade(pub Vec); -deref!(Upgrade -> Vec) +deref!(Upgrade -> Vec); /// 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()] }); + diff --git a/src/header/common/user_agent.rs b/src/header/common/user_agent.rs index d201e4b1..f35e7cbd 100644 --- a/src/header/common/user_agent.rs +++ b/src/header/common/user_agent.rs @@ -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) -> &'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()] }); diff --git a/src/header/mod.rs b/src/header/mod.rs index 086bbb75..01cb3f80 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -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()) } } diff --git a/src/lib.rs b/src/lib.rs index e993737c..3e199ce6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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] diff --git a/src/mock.rs b/src/mock.rs index fdecd5e7..6f4867fb 100644 --- a/src/mock.rs +++ b/src/mock.rs @@ -104,4 +104,5 @@ macro_rules! mock_connector ( } ) -) +); + diff --git a/src/server/mod.rs b/src/server/mod.rs index 0ce996bb..a3fc9039 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -38,7 +38,7 @@ macro_rules! try_option( None => return None } }} -) +); impl Server { /// Creates a new server that will handle `HttpStream`s. diff --git a/src/server/request.rs b/src/server/request.rs index d43b27d4..b35efcc5 100644 --- a/src/server/request.rs +++ b/src/server/request.rs @@ -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() {