From cd11293c1f1d88515797aa31bf8351e0a3c44144 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Sun, 6 May 2018 19:07:30 +0300 Subject: [PATCH 1/2] spelling check --- src/error.rs | 10 +++++----- src/extractor.rs | 2 +- src/header/shared/charset.rs | 2 +- src/httprequest.rs | 14 +++++++------- src/lib.rs | 2 +- src/middleware/errhandlers.rs | 2 +- src/route.rs | 6 +++--- src/router.rs | 6 +++--- src/test.rs | 2 +- src/ws/client.rs | 4 ++-- tools/wsload/src/wsclient.rs | 2 +- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/error.rs b/src/error.rs index 5ef2ddd7..5d886ec7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -310,7 +310,7 @@ pub enum HttpRangeError { /// See `https://github.com/golang/go/commit/aa9b3d7` #[fail( display = "First-byte-pos of all of the byte-range-spec values is greater than the content size" - )] + )] NoOverlap, } @@ -392,7 +392,7 @@ impl ResponseError for ExpectError { } } -/// A set of error that can occure during parsing content type +/// A set of error that can occurred during parsing content type #[derive(Fail, PartialEq, Debug)] pub enum ContentTypeError { /// Can not parse content type @@ -542,7 +542,7 @@ impl From for UrlGenerationError { /// Helper type that can wrap any error and generate custom response. /// /// In following example any `io::Error` will be converted into "BAD REQUEST" -/// response as opposite to *INNTERNAL SERVER ERROR* which is defined by +/// response as opposite to *INTERNAL SERVER ERROR* which is defined by /// default. /// /// ```rust @@ -850,7 +850,7 @@ mod tests { } macro_rules! from { - ($from:expr => $error:pat) => { + ($from: expr => $error: pat) => { match ParseError::from($from) { e @ $error => { assert!(format!("{}", e).len() >= 5); @@ -861,7 +861,7 @@ mod tests { } macro_rules! from_and_cause { - ($from:expr => $error:pat) => { + ($from: expr => $error: pat) => { match ParseError::from($from) { e @ $error => { let desc = format!("{}", e.cause().unwrap()); diff --git a/src/extractor.rs b/src/extractor.rs index c83b238d..1f06f782 100644 --- a/src/extractor.rs +++ b/src/extractor.rs @@ -715,7 +715,7 @@ mod tests { } #[test] - fn test_extract_path_signle() { + fn test_extract_path_single() { let mut resource = ResourceHandler::<()>::default(); resource.name("index"); let mut routes = Vec::new(); diff --git a/src/header/shared/charset.rs b/src/header/shared/charset.rs index bab9d65d..21ee637b 100644 --- a/src/header/shared/charset.rs +++ b/src/header/shared/charset.rs @@ -7,7 +7,7 @@ use self::Charset::*; /// A Mime charset. /// -/// The string representation is normalised to upper case. +/// The string representation is normalized to upper case. /// /// See [http://www.iana.org/assignments/character-sets/character-sets.xhtml][url]. /// diff --git a/src/httprequest.rs b/src/httprequest.rs index 12e5da1d..42adc63a 100644 --- a/src/httprequest.rs +++ b/src/httprequest.rs @@ -199,7 +199,7 @@ impl HttpRequest { &self.as_ref().extensions } - /// Mutable refernece to a the request's extensions + /// Mutable reference to a the request's extensions #[inline] pub fn extensions_mut(&mut self) -> &mut Extensions { &mut self.as_mut().extensions @@ -665,8 +665,8 @@ mod tests { let mut resource = ResourceHandler::<()>::default(); resource.name("index"); let routes = vec![( - Resource::new("index", "/user/{name}.{ext}"), - Some(resource), + Resource::new("index", "/user/{name}.{ext}"), + Some(resource), )]; let (router, _) = Router::new("/", ServerSettings::default(), routes); assert!(router.has_route("/user/test.html")); @@ -697,8 +697,8 @@ mod tests { let mut resource = ResourceHandler::<()>::default(); resource.name("index"); let routes = vec![( - Resource::new("index", "/user/{name}.{ext}"), - Some(resource), + Resource::new("index", "/user/{name}.{ext}"), + Some(resource), )]; let (router, _) = Router::new("/prefix/", ServerSettings::default(), routes); assert!(router.has_route("/user/test.html")); @@ -719,8 +719,8 @@ mod tests { let mut resource = ResourceHandler::<()>::default(); resource.name("index"); let routes = vec![( - Resource::external("youtube", "https://youtube.com/watch/{video_id}"), - None, + Resource::external("youtube", "https://youtube.com/watch/{video_id}"), + None, )]; let (router, _) = Router::new::<()>("", ServerSettings::default(), routes); assert!(!router.has_route("https://youtube.com/watch/unknown")); diff --git a/src/lib.rs b/src/lib.rs index 180e29af..92a319bc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,7 +44,7 @@ //! * [HttpRequest](struct.HttpRequest.html) and //! [HttpResponse](struct.HttpResponse.html): These structs //! represent HTTP requests and responses and expose various methods -//! for inspecting, creating and otherwise utilising them. +//! for inspecting, creating and otherwise utilizing them. //! //! ## Features //! diff --git a/src/middleware/errhandlers.rs b/src/middleware/errhandlers.rs index 22d0e1af..757b3815 100644 --- a/src/middleware/errhandlers.rs +++ b/src/middleware/errhandlers.rs @@ -12,7 +12,7 @@ type ErrorHandler = Fn(&mut HttpRequest, HttpResponse) -> Result /// /// You can use `ErrorHandlers::handler()` method to register a custom error /// handler for specific status code. You can modify existing response or -/// create completly new one. +/// create completely new one. /// /// ## Example /// diff --git a/src/route.rs b/src/route.rs index 1623702d..d17f13f1 100644 --- a/src/route.rs +++ b/src/route.rs @@ -104,7 +104,7 @@ impl Route { self.handler = InnerHandler::async(handler); } - /// Set handler function, use request extractor for paramters. + /// Set handler function, use request extractor for parameters. /// /// ```rust /// # extern crate bytes; @@ -140,7 +140,7 @@ impl Route { cfg } - /// Set handler function, use request extractor for both paramters. + /// Set handler function, use request extractor for both parameters. /// /// ```rust /// # extern crate bytes; @@ -189,7 +189,7 @@ impl Route { (cfg1, cfg2) } - /// Set handler function, use request extractor for all paramters. + /// Set handler function, use request extractor for all parameters. pub fn with3( &mut self, handler: F, ) -> ( diff --git a/src/router.rs b/src/router.rs index 6c5a7da6..2c7d5c32 100644 --- a/src/router.rs +++ b/src/router.rs @@ -150,7 +150,7 @@ enum PatternType { pub enum ResourceType { /// Normal resource Normal, - /// Resource for applicaiton default handler + /// Resource for application default handler Default, /// External resource External, @@ -158,7 +158,7 @@ pub enum ResourceType { Unset, } -/// Reslource type describes an entry in resources table +/// Resource type describes an entry in resources table #[derive(Clone)] pub struct Resource { tp: PatternType, @@ -268,7 +268,7 @@ impl Resource { } } - /// Build reousrce path. + /// Build resource path. pub fn resource_path( &self, router: &Router, elements: U, ) -> Result diff --git a/src/test.rs b/src/test.rs index c712edd6..4e739839 100644 --- a/src/test.rs +++ b/src/test.rs @@ -88,7 +88,7 @@ impl TestServer { /// Create test server builder with specific state factory /// /// This method can be used for constructing application state. - /// Also it can be used for external dependecy initialization, + /// Also it can be used for external dependency initialization, /// like creating sync actors for diesel integration. pub fn build_with_state(state: F) -> TestServerBuilder where diff --git a/src/ws/client.rs b/src/ws/client.rs index 07b44b4d..64aaa8e4 100644 --- a/src/ws/client.rs +++ b/src/ws/client.rs @@ -256,9 +256,9 @@ struct Inner { closed: bool, } -/// Future that implementes client websocket handshake process. +/// Future that implemented client websocket handshake process. /// -/// It resolves to a pair of `ClientReadr` and `ClientWriter` that +/// It resolves to a pair of `ClientReader` and `ClientWriter` that /// can be used for reading and writing websocket frames. pub struct ClientHandshake { request: Option, diff --git a/tools/wsload/src/wsclient.rs b/tools/wsload/src/wsclient.rs index d8d7b660..186d6317 100644 --- a/tools/wsload/src/wsclient.rs +++ b/tools/wsload/src/wsclient.rs @@ -259,7 +259,7 @@ impl StreamHandler for ChatClient { ctx.stop(); } } else { - println!("not eaqual"); + println!("not equal"); } } _ => (), From 599fd6af93f7fd90996de86d9db7714081266041 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Mon, 7 May 2018 20:53:45 +0300 Subject: [PATCH 2/2] fix formatting --- src/error.rs | 4 ++-- src/httprequest.rs | 12 ++++++------ src/ws/client.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/error.rs b/src/error.rs index 5d886ec7..9482e067 100644 --- a/src/error.rs +++ b/src/error.rs @@ -310,7 +310,7 @@ pub enum HttpRangeError { /// See `https://github.com/golang/go/commit/aa9b3d7` #[fail( display = "First-byte-pos of all of the byte-range-spec values is greater than the content size" - )] + )] NoOverlap, } @@ -392,7 +392,7 @@ impl ResponseError for ExpectError { } } -/// A set of error that can occurred during parsing content type +/// A set of error that can occure during parsing content type #[derive(Fail, PartialEq, Debug)] pub enum ContentTypeError { /// Can not parse content type diff --git a/src/httprequest.rs b/src/httprequest.rs index 42adc63a..229c0687 100644 --- a/src/httprequest.rs +++ b/src/httprequest.rs @@ -665,8 +665,8 @@ mod tests { let mut resource = ResourceHandler::<()>::default(); resource.name("index"); let routes = vec![( - Resource::new("index", "/user/{name}.{ext}"), - Some(resource), + Resource::new("index", "/user/{name}.{ext}"), + Some(resource), )]; let (router, _) = Router::new("/", ServerSettings::default(), routes); assert!(router.has_route("/user/test.html")); @@ -697,8 +697,8 @@ mod tests { let mut resource = ResourceHandler::<()>::default(); resource.name("index"); let routes = vec![( - Resource::new("index", "/user/{name}.{ext}"), - Some(resource), + Resource::new("index", "/user/{name}.{ext}"), + Some(resource), )]; let (router, _) = Router::new("/prefix/", ServerSettings::default(), routes); assert!(router.has_route("/user/test.html")); @@ -719,8 +719,8 @@ mod tests { let mut resource = ResourceHandler::<()>::default(); resource.name("index"); let routes = vec![( - Resource::external("youtube", "https://youtube.com/watch/{video_id}"), - None, + Resource::external("youtube", "https://youtube.com/watch/{video_id}"), + None, )]; let (router, _) = Router::new::<()>("", ServerSettings::default(), routes); assert!(!router.has_route("https://youtube.com/watch/unknown")); diff --git a/src/ws/client.rs b/src/ws/client.rs index 64aaa8e4..aa392a90 100644 --- a/src/ws/client.rs +++ b/src/ws/client.rs @@ -256,7 +256,7 @@ struct Inner { closed: bool, } -/// Future that implemented client websocket handshake process. +/// Future that implementes client websocket handshake process. /// /// It resolves to a pair of `ClientReader` and `ClientWriter` that /// can be used for reading and writing websocket frames.