From 35825c4614b22c95ad9e214eb1d2849f89c82598 Mon Sep 17 00:00:00 2001 From: Vivek Ghaisas Date: Fri, 20 Dec 2019 21:41:23 +0530 Subject: [PATCH] style(comments): correct some typos in Rust code comments --- examples/http_proxy.rs | 4 ++-- src/client/conn.rs | 4 ++-- src/client/connect/http.rs | 2 +- src/client/mod.rs | 4 ++-- src/client/pool.rs | 2 +- src/client/tests.rs | 2 +- src/proto/h1/encode.rs | 2 +- src/proto/h1/role.rs | 8 ++++---- src/server/conn.rs | 4 ++-- tests/client.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/http_proxy.rs b/examples/http_proxy.rs index 1695d1a1..e237b995 100644 --- a/examples/http_proxy.rs +++ b/examples/http_proxy.rs @@ -43,7 +43,7 @@ async fn proxy(client: HttpClient, req: Request) -> Result, println!("req: {:?}", req); if Method::CONNECT == req.method() { - // Recieved an HTTP request like: + // Received an HTTP request like: // ``` // CONNECT www.domain.com:443 HTTP/1.1 // Host: www.domain.com:443 @@ -53,7 +53,7 @@ async fn proxy(client: HttpClient, req: Request) -> Result, // When HTTP method is CONNECT we should return an empty body // then we can eventually upgrade the connection and talk a new protocol. // - // Note: only after client recieved an empty body with STATUS_OK can the + // Note: only after client received an empty body with STATUS_OK can the // connection be upgraded, so we can't return a response inside // `on_upgrade` future. if let Some(addr) = host_addr(req.uri()) { diff --git a/src/client/conn.rs b/src/client/conn.rs index c969d839..1daf2766 100644 --- a/src/client/conn.rs +++ b/src/client/conn.rs @@ -36,7 +36,7 @@ where } // Our defaults are chosen for the "majority" case, which usually are not -// resource contrained, and so the spec default of 64kb can be too limiting +// resource constrained, and so the spec default of 64kb can be too limiting // for performance. const DEFAULT_HTTP2_CONN_WINDOW: u32 = 1024 * 1024 * 5; // 5mb const DEFAULT_HTTP2_STREAM_WINDOW: u32 = 1024 * 1024 * 2; // 2mb @@ -356,7 +356,7 @@ where /// /// This is useful to allow running a connection while doing an HTTP /// upgrade. Once the upgrade is completed, the connection would be "done", - /// but it is not desired to actally shutdown the IO object. Instead you + /// but it is not desired to actually shutdown the IO object. Instead you /// would take it back using `into_parts`. /// /// Use [`poll_fn`](https://docs.rs/futures/0.1.25/futures/future/fn.poll_fn.html) diff --git a/src/client/connect/http.rs b/src/client/connect/http.rs index e4bdd7ca..8c50d725 100644 --- a/src/client/connect/http.rs +++ b/src/client/connect/http.rs @@ -775,7 +775,7 @@ mod tests { ]; // Scenarios for IPv6 -> IPv4 fallback require that host can access IPv6 network. - // Otherwise, connection to "slow" IPv6 address will error-out immediatelly. + // Otherwise, connection to "slow" IPv6 address will error-out immediately. let ipv6_accessible = measure_connect(slow_ipv6_addr()).0; for &(hosts, family, timeout, needs_ipv6_access) in scenarios { diff --git a/src/client/mod.rs b/src/client/mod.rs index c19fb6cd..d4c69820 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -390,7 +390,7 @@ where // - Meanwhile, the pool Checkout is watching to see if any other // request finishes and tries to insert an idle connection. // - If a new connection is started, but the Checkout wins after - // (an idle connection becamse available first), the started + // (an idle connection became available first), the started // connection future is spawned into the runtime to complete, // and then be inserted into the pool as an idle connection. let checkout = self.pool.checkout(pool_key.clone()); @@ -469,7 +469,7 @@ where // Try to take a "connecting lock". // // If the pool_key is for HTTP/2, and there is already a - // connection being estabalished, then this can't take a + // connection being established, then this can't take a // second lock. The "connect_to" future is Canceled. let connecting = match pool.connecting(&pool_key, ver) { Some(lock) => lock, diff --git a/src/client/pool.rs b/src/client/pool.rs index 8f365aef..274ae242 100644 --- a/src/client/pool.rs +++ b/src/client/pool.rs @@ -55,7 +55,7 @@ pub(super) enum Reservation { pub(super) type Key = Arc; struct PoolInner { - // A flag that a connection is being estabilished, and the connection + // A flag that a connection is being established, and the connection // should be shared. This prevents making multiple HTTP/2 connections // to the same host. connecting: HashSet, diff --git a/src/client/tests.rs b/src/client/tests.rs index 4f409c40..8088f0ea 100644 --- a/src/client/tests.rs +++ b/src/client/tests.rs @@ -97,7 +97,7 @@ fn conn_reset_after_write() { // has written the second request, and THEN disconnect. // // Not because we expect servers to be jerks, but to trigger - // state where we write on an assumedly good connetion, and + // state where we write on an assumedly good connection, and // only reset the close AFTER we wrote bytes. try_ready!(sock1.as_mut().unwrap().read(&mut [0u8; 512])); sock1.take(); diff --git a/src/proto/h1/encode.rs b/src/proto/h1/encode.rs index 810926bd..da280a16 100644 --- a/src/proto/h1/encode.rs +++ b/src/proto/h1/encode.rs @@ -31,7 +31,7 @@ enum Kind { /// /// Enforces that the body is not longer than the Content-Length header. Length(u64), - /// An Encoder for when neither Content-Length nore Chunked encoding is set. + /// An Encoder for when neither Content-Length nor Chunked encoding is set. /// /// This is mostly only used with HTTP/1.0 with a length. This kind requires /// the connection to be closed when the body is finished. diff --git a/src/proto/h1/role.rs b/src/proto/h1/role.rs index 4b93b340..31d856dc 100644 --- a/src/proto/h1/role.rs +++ b/src/proto/h1/role.rs @@ -81,7 +81,7 @@ impl Http1Transaction for Server { let len; let headers_len; - // Unsafe: both headers_indices and headers are using unitialized memory, + // Unsafe: both headers_indices and headers are using uninitialized memory, // but we *never* read any of it until after httparse has assigned // values into it. By not zeroing out the stack memory, this saves // a good ~5% on pipeline benchmarks. @@ -165,7 +165,7 @@ impl Http1Transaction for Server { // https://tools.ietf.org/html/rfc7230#section-3.3.3 // If Transfer-Encoding header is present, and 'chunked' is // not the final encoding, and this is a Request, then it is - // mal-formed. A server should respond with 400 Bad Request. + // malformed. A server should respond with 400 Bad Request. if !is_http_11 { debug!("HTTP/1.0 cannot have Transfer-Encoding header"); return Err(Parse::Header); @@ -406,7 +406,7 @@ impl Http1Transaction for Server { debug_assert!(is_name_written); continue 'headers; } else { - // we haven't written content-lenght yet! + // we haven't written content-length yet! encoder = Encoder::length(len); extend(dst, b"content-length: "); extend(dst, value.as_bytes()); @@ -792,7 +792,7 @@ impl Client { // https://tools.ietf.org/html/rfc7230#section-3.3.3 // If Transfer-Encoding header is present, and 'chunked' is // not the final encoding, and this is a Request, then it is - // mal-formed. A server should respond with 400 Bad Request. + // malformed. A server should respond with 400 Bad Request. if inc.version == Version::HTTP_10 { debug!("HTTP/1.0 cannot have Transfer-Encoding header"); Err(Parse::Header) diff --git a/src/server/conn.rs b/src/server/conn.rs index a2c5c094..222ef958 100644 --- a/src/server/conn.rs +++ b/src/server/conn.rs @@ -37,7 +37,7 @@ pub(super) use self::upgrades::UpgradeableConnection; pub use super::tcp::{AddrIncoming, AddrStream}; // Our defaults are chosen for the "majority" case, which usually are not -// resource contrained, and so the spec default of 64kb can be too limiting +// resource constrained, and so the spec default of 64kb can be too limiting // for performance. // // At the same time, a server more often has multiple clients connected, and @@ -504,7 +504,7 @@ where /// /// This is useful to allow running a connection while doing an HTTP /// upgrade. Once the upgrade is completed, the connection would be "done", - /// but it is not desired to actally shutdown the IO object. Instead you + /// but it is not desired to actually shutdown the IO object. Instead you /// would take it back using `into_parts`. /// /// Use [`poll_fn`](https://docs.rs/futures/0.1.25/futures/future/fn.poll_fn.html) diff --git a/tests/client.rs b/tests/client.rs index 636b6d7e..141d5ce8 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -1240,7 +1240,7 @@ mod dispatch_impl { .uri(&*format!("http://{}/a", addr)) .body(Body::empty()) .unwrap(); - // notably, havent read body yet + // notably, haven't read body yet client.request(req) };