From e1d9c3803bf9e689bc52c8e1bf0253aeea136724 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Tue, 16 Jan 2018 00:47:25 +0300 Subject: [PATCH 1/2] spelling check --- src/application.rs | 2 +- src/body.rs | 2 +- src/context.rs | 2 +- src/error.rs | 6 +++--- src/handler.rs | 6 +++--- src/httprequest.rs | 4 ++-- src/middleware/session.rs | 2 +- src/param.rs | 2 +- src/pipeline.rs | 2 +- src/resource.rs | 2 +- src/server/encoding.rs | 2 +- src/server/h1.rs | 4 ++-- src/server/srv.rs | 16 ++++++++-------- src/test.rs | 10 +++++----- src/ws/frame.rs | 2 +- 15 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/application.rs b/src/application.rs index ecd65c6e0..62ed470b3 100644 --- a/src/application.rs +++ b/src/application.rs @@ -136,7 +136,7 @@ impl Application where S: 'static { /// Create application with specific state. Application can be /// configured with builder-like pattern. /// - /// State is shared with all reousrces within same application and could be + /// State is shared with all resources within same application and could be /// accessed with `HttpRequest::state()` method. pub fn with_state(state: S) -> Application { Application { diff --git a/src/body.rs b/src/body.rs index beecf8bfa..ebd011e9c 100644 --- a/src/body.rs +++ b/src/body.rs @@ -31,7 +31,7 @@ pub enum Binary { Bytes(Bytes), /// Static slice Slice(&'static [u8]), - /// Shared stirng body + /// Shared string body SharedString(Rc), /// Shared string body #[doc(hidden)] diff --git a/src/context.rs b/src/context.rs index f518e24ad..d3fa212f5 100644 --- a/src/context.rs +++ b/src/context.rs @@ -127,7 +127,7 @@ impl HttpContext where A: Actor { } } - /// Indicate end of streamimng payload. Also this method calls `Self::close`. + /// Indicate end of streaming payload. Also this method calls `Self::close`. #[inline] pub fn write_eof(&mut self) { self.add_frame(Frame::Chunk(None)); diff --git a/src/error.rs b/src/error.rs index 29a94d4c0..0fe12a807 100644 --- a/src/error.rs +++ b/src/error.rs @@ -320,7 +320,7 @@ pub enum WsHandshakeError { /// Only get method is allowed #[fail(display="Method not allowed")] GetMethodRequired, - /// Ugrade header if not set to websocket + /// Upgrade header if not set to websocket #[fail(display="Websocket upgrade is expected")] NoWebsocketUpgrade, /// Connection header is not set to upgrade @@ -329,7 +329,7 @@ pub enum WsHandshakeError { /// Websocket version header is not set #[fail(display="Websocket version header is required")] NoVersionHeader, - /// Unsupported websockt version + /// Unsupported websocket version #[fail(display="Unsupported version")] UnsupportedVersion, /// Websocket key is not set or wrong @@ -510,7 +510,7 @@ macro_rules! ERROR_WRAP { /// Helper type that can wrap any error and generate *BAD REQUEST* response. /// /// In following example any `io::Error` will be converted into "BAD REQUEST" response -/// as oposite to *INNTERNAL SERVER ERROR* which is defined by default. +/// as opposite to *INNTERNAL SERVER ERROR* which is defined by default. /// /// ```rust /// # extern crate actix_web; diff --git a/src/handler.rs b/src/handler.rs index 8f6861e5f..561ee77b8 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -9,7 +9,7 @@ use error::Error; use httprequest::HttpRequest; use httpresponse::HttpResponse; -/// Trait defines object that could be regestered as route handler +/// Trait defines object that could be registered as route handler #[allow(unused_variables)] pub trait Handler: 'static { @@ -35,7 +35,7 @@ pub trait Responder { } #[doc(hidden)] -/// Convinience trait that convert `Future` object into `Boxed` future +/// Convenience trait that convert `Future` object into `Boxed` future pub trait AsyncResponder: Sized { fn responder(self) -> Box>; } @@ -193,7 +193,7 @@ impl Responder for Box> } } -/// Trait defines object that could be regestered as resource route +/// Trait defines object that could be registered as resource route pub(crate) trait RouteHandler: 'static { fn handle(&mut self, req: HttpRequest) -> Reply; } diff --git a/src/httprequest.rs b/src/httprequest.rs index 2498a9298..14c252748 100644 --- a/src/httprequest.rs +++ b/src/httprequest.rs @@ -222,7 +222,7 @@ impl HttpRequest { self.uri().path() } - /// Get *ConnectionInfo* for currect request. + /// Get *ConnectionInfo* for correct request. pub fn connection_info(&self) -> &ConnectionInfo { if self.as_ref().info.is_none() { let info: ConnectionInfo<'static> = unsafe{ @@ -278,7 +278,7 @@ impl HttpRequest { /// Peer socket address /// - /// Peer address is actuall socket address, if proxy is used in front of + /// Peer address is actual socket address, if proxy is used in front of /// actix http server, then peer address would be address of this proxy. /// /// To get client connection information `connection_info()` method should be used. diff --git a/src/middleware/session.rs b/src/middleware/session.rs index 9a2604dbc..ad865669f 100644 --- a/src/middleware/session.rs +++ b/src/middleware/session.rs @@ -217,7 +217,7 @@ pub struct CookieSession { inner: Rc, } -/// Errors that can occure during handling cookie session +/// Errors that can occur during handling cookie session #[derive(Fail, Debug)] pub enum CookieSessionError { /// Size of the serialized session is greater than 4000 bytes. diff --git a/src/param.rs b/src/param.rs index 530e62089..59454a76d 100644 --- a/src/param.rs +++ b/src/param.rs @@ -77,7 +77,7 @@ impl<'a> Params<'a> { } } - /// Return iterator to items in paramter container + /// Return iterator to items in parameter container pub fn iter(&self) -> Iter<(Cow<'a, str>, Cow<'a, str>)> { self.0.iter() } diff --git a/src/pipeline.rs b/src/pipeline.rs index 7335dec6a..55d2a4f8b 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -210,7 +210,7 @@ impl> StartMiddlewares { fn init(info: &mut PipelineInfo, handler: Rc>) -> PipelineState { // execute middlewares, we need this stage because middlewares could be non-async - // and we can move to next state immidietly + // and we can move to next state immediately let len = info.mws.len(); loop { if info.count == len { diff --git a/src/resource.rs b/src/resource.rs index c9e1251c0..eb783a227 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -19,7 +19,7 @@ use httpresponse::HttpResponse; /// Route uses builder-like pattern for configuration. /// During request handling, resource object iterate through all routes /// and check all predicates for specific route, if request matches all predicates route -/// route considired matched and route handler get called. +/// route considered matched and route handler get called. /// /// ```rust /// # extern crate actix_web; diff --git a/src/server/encoding.rs b/src/server/encoding.rs index e5b75c482..48f5a4092 100644 --- a/src/server/encoding.rs +++ b/src/server/encoding.rs @@ -646,7 +646,7 @@ enum TransferEncodingKind { Length(u64), /// An Encoder for when Content-Length is not known. /// - /// Appliction decides when to stop writing. + /// Application decides when to stop writing. Eof, } diff --git a/src/server/h1.rs b/src/server/h1.rs index 67ec26372..dce67755b 100644 --- a/src/server/h1.rs +++ b/src/server/h1.rs @@ -96,7 +96,7 @@ impl Http1 } } - // TODO: refacrtor + // TODO: refactor #[cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))] pub fn poll(&mut self) -> Poll<(), ()> { // keep-alive timer @@ -133,7 +133,7 @@ impl Http1 Ok(Async::Ready(ready)) => { not_ready = false; - // overide keep-alive state + // override keep-alive state if self.stream.keepalive() { self.flags.insert(Flags::KEEPALIVE); } else { diff --git a/src/server/srv.rs b/src/server/srv.rs index 050c862c0..16c7e34cd 100644 --- a/src/server/srv.rs +++ b/src/server/srv.rs @@ -268,9 +268,9 @@ impl HttpServer where U: IntoIterator + 'static, V: IntoHttpHandler, { - /// Start listening for incomming connections. + /// Start listening for incoming connections. /// - /// This method starts number of http handler workers in seperate threads. + /// This method starts number of http handler workers in separate threads. /// For each address this method starts separate thread which does `accept()` in a loop. /// /// This methods panics if no socket addresses get bound. @@ -298,7 +298,7 @@ impl HttpServer pub fn start(mut self) -> SyncAddress { if self.sockets.is_empty() { - panic!("HttpServer::bind() has to be called befor start()"); + panic!("HttpServer::bind() has to be called before start()"); } else { let addrs: Vec<(net::SocketAddr, net::TcpListener)> = self.sockets.drain().collect(); @@ -320,7 +320,7 @@ impl HttpServer } } - /// Spawn new thread and start listening for incomming connections. + /// Spawn new thread and start listening for incoming connections. /// /// This method spawns new thread and starts new actix system. Other than that it is /// similar to `start()` method. This method blocks. @@ -359,7 +359,7 @@ impl HttpServer, net::SocketAddr, H, where U: IntoIterator + 'static, V: IntoHttpHandler, { - /// Start listening for incomming tls connections. + /// Start listening for incoming tls connections. pub fn start_tls(mut self, pkcs12: ::Pkcs12) -> io::Result> { if self.sockets.is_empty() { Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound")) @@ -398,7 +398,7 @@ impl HttpServer, net::SocketAddr, H, where U: IntoIterator + 'static, V: IntoHttpHandler, { - /// Start listening for incomming tls connections. + /// Start listening for incoming tls connections. /// /// This method sets alpn protocols to "h2" and "http/1.1" pub fn start_ssl(mut self, identity: &ParsedPkcs12) -> io::Result> { @@ -443,7 +443,7 @@ impl HttpServer, A, H, U> U: IntoIterator + 'static, V: IntoHttpHandler, { - /// Start listening for incomming connections from a stream. + /// Start listening for incoming connections from a stream. /// /// This method uses only one thread for handling incoming connections. pub fn start_incoming(mut self, stream: S, secure: bool) -> SyncAddress @@ -663,7 +663,7 @@ fn start_accept_thread(sock: net::TcpListener, addr: net::SocketAddr, backlog: i } } - // Start listening for incommin commands + // Start listening for incoming commands if let Err(err) = poll.register(®, CMD, mio::Ready::readable(), mio::PollOpt::edge()) { panic!("Can not register Registration: {}", err); diff --git a/src/test.rs b/src/test.rs index 5616ae554..fffc6d023 100644 --- a/src/test.rs +++ b/src/test.rs @@ -29,7 +29,7 @@ use server::{HttpServer, HttpHandler, IntoHttpHandler, ServerSettings}; /// The `TestServer` type. /// /// `TestServer` is very simple test server that simplify process of writing -/// integrational tests cases for actix web applications. +/// integration tests cases for actix web applications. /// /// # Examples /// @@ -61,7 +61,7 @@ impl TestServer { /// Start new test server /// - /// This methos accepts configuration method. You can add + /// This method accepts configuration method. You can add /// middlewares or set handlers for test application. pub fn new(config: F) -> Self where F: Sync + Send + 'static + Fn(&mut TestApp<()>), @@ -101,7 +101,7 @@ impl TestServer { /// Start new test server with custom application state /// - /// This methos accepts state factory and configuration method. + /// This method accepts state factory and configuration method. pub fn with_state(state: FS, config: F) -> Self where S: 'static, FS: Sync + Send + 'static + Fn() -> S, @@ -287,12 +287,12 @@ impl Default for TestRequest<()> { impl TestRequest<()> { - /// Create TestReqeust and set request uri + /// Create TestRequest and set request uri pub fn with_uri(path: &str) -> TestRequest<()> { TestRequest::default().uri(path) } - /// Create TestReqeust and set header + /// Create TestRequest and set header pub fn with_header(key: K, value: V) -> TestRequest<()> where HeaderName: HttpTryFrom, HeaderValue: HttpTryFrom diff --git a/src/ws/frame.rs b/src/ws/frame.rs index 823292a98..20b98b638 100644 --- a/src/ws/frame.rs +++ b/src/ws/frame.rs @@ -28,7 +28,7 @@ pub(crate) struct Frame { impl Frame { - /// Desctructe frame + /// Destruct frame pub fn unpack(self) -> (bool, OpCode, Binary) { (self.finished, self.opcode, self.payload) } From 58df8fa4b9927dfce9396b8794bf11863c9bd7ec Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Tue, 16 Jan 2018 21:59:33 +0300 Subject: [PATCH 2/2] spelling check --- examples/diesel/src/db.rs | 2 +- examples/state/src/main.rs | 2 +- examples/tls/src/main.rs | 2 +- examples/websocket-chat/README.md | 4 ++-- examples/websocket-chat/src/session.rs | 6 +++--- src/application.rs | 2 +- src/handler.rs | 2 +- src/middleware/cors.rs | 2 +- src/server/h1.rs | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/diesel/src/db.rs b/examples/diesel/src/db.rs index 04daa6ed0..4ca85130e 100644 --- a/examples/diesel/src/db.rs +++ b/examples/diesel/src/db.rs @@ -8,7 +8,7 @@ use diesel::prelude::*; use models; use schema; -/// This is db executor actor. We are going to run 3 of them in parallele. +/// This is db executor actor. We are going to run 3 of them in parallel. pub struct DbExecutor(pub SqliteConnection); /// This is only message that this actor can handle, but it is easy to extend number of diff --git a/examples/state/src/main.rs b/examples/state/src/main.rs index 8216be242..5bb7e5043 100644 --- a/examples/state/src/main.rs +++ b/examples/state/src/main.rs @@ -1,5 +1,5 @@ #![cfg_attr(feature="cargo-clippy", allow(needless_pass_by_value))] -//! There are two level of statfulness in actix-web. Application has state +//! There are two level of statefulness in actix-web. Application has state //! that is shared across all handlers within same Application. //! And individual handler can have state. diff --git a/examples/tls/src/main.rs b/examples/tls/src/main.rs index 15cfcc666..03a3e5067 100644 --- a/examples/tls/src/main.rs +++ b/examples/tls/src/main.rs @@ -9,7 +9,7 @@ use std::io::Read; use actix_web::*; -/// somple handle +/// simple handle fn index(req: HttpRequest) -> Result { println!("{:?}", req); Ok(httpcodes::HTTPOk diff --git a/examples/websocket-chat/README.md b/examples/websocket-chat/README.md index 28d734dd3..a01dd68b7 100644 --- a/examples/websocket-chat/README.md +++ b/examples/websocket-chat/README.md @@ -16,8 +16,8 @@ Chat server listens for incoming tcp connections. Server can access several type * `\list` - list all available rooms * `\join name` - join room, if room does not exist, create new one * `\name name` - set session name -* `some message` - just string, send messsage to all peers in same room -* client has to send heartbeat `Ping` messages, if server does not receive a heartbeat message for 10 seconds connection gets droppped +* `some message` - just string, send message to all peers in same room +* client has to send heartbeat `Ping` messages, if server does not receive a heartbeat message for 10 seconds connection gets dropped To start server use command: `cargo run --bin server` diff --git a/examples/websocket-chat/src/session.rs b/examples/websocket-chat/src/session.rs index b0725fde4..66062533f 100644 --- a/examples/websocket-chat/src/session.rs +++ b/examples/websocket-chat/src/session.rs @@ -16,7 +16,7 @@ use codec::{ChatRequest, ChatResponse, ChatCodec}; #[derive(Message)] pub struct Message(pub String); -/// `ChatSession` actor is responsible for tcp peer communitions. +/// `ChatSession` actor is responsible for tcp peer communications. pub struct ChatSession { /// unique session id id: usize, @@ -30,7 +30,7 @@ pub struct ChatSession { impl Actor for ChatSession { /// For tcp communication we are going to use `FramedContext`. - /// It is convinient wrapper around `Framed` object from `tokio_io` + /// It is convenient wrapper around `Framed` object from `tokio_io` type Context = FramedContext; fn started(&mut self, ctx: &mut Self::Context) { @@ -149,7 +149,7 @@ impl ChatSession { } -/// Define tcp server that will accept incomint tcp connection and create +/// Define tcp server that will accept incoming tcp connection and create /// chat actors. pub struct TcpServer { chat: SyncAddress, diff --git a/src/application.rs b/src/application.rs index 62ed470b3..047364b85 100644 --- a/src/application.rs +++ b/src/application.rs @@ -156,7 +156,7 @@ impl Application where S: 'static { /// Set application prefix /// /// Only requests that matches application's prefix get processed by this application. - /// Application prefix always contains laading "/" slash. If supplied prefix + /// Application prefix always contains leading "/" slash. If supplied prefix /// does not contain leading slash, it get inserted. Prefix should /// consists valid path segments. i.e for application with /// prefix `/app` any request with following paths `/app`, `/app/` or `/app/test` diff --git a/src/handler.rs b/src/handler.rs index 561ee77b8..16de0583d 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -341,7 +341,7 @@ impl Default for NormalizePath { } impl NormalizePath { - /// Create new `NoramlizePath` instance + /// Create new `NormalizePath` instance pub fn new(append: bool, merge: bool, redirect: StatusCode) -> NormalizePath { NormalizePath { append: append, diff --git a/src/middleware/cors.rs b/src/middleware/cors.rs index 5c55c188c..c495a31e0 100644 --- a/src/middleware/cors.rs +++ b/src/middleware/cors.rs @@ -214,7 +214,7 @@ impl Cors { /// This method register cors middleware with resource and /// adds route for *OPTIONS* preflight requests. /// - /// It is possible to register *Cors* middlware with `Resource::middleware()` + /// It is possible to register *Cors* middleware with `Resource::middleware()` /// method, but in that case *Cors* middleware wont be able to handle *OPTIONS* /// requests. pub fn register(self, resource: &mut Resource) { diff --git a/src/server/h1.rs b/src/server/h1.rs index dce67755b..4de37ebe5 100644 --- a/src/server/h1.rs +++ b/src/server/h1.rs @@ -1206,7 +1206,7 @@ mod tests { let mut buf = Buffer::new( "GET /test HTTP/1.1\r\n\ - transfer-encoding: chnked\r\n\r\n"); + transfer-encoding: chunked\r\n\r\n"); let req = parse_ready!(&mut buf); if let Ok(val) = req.chunked() {