From 0bd2db88c9678e9dd1cc9a9018c630ad07811090 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 12 Nov 2024 15:26:53 -0400 Subject: [PATCH] spelling cleanup --- .github/workflows/ci.yml | 16 +++++----- CHANGELOG.md | 18 ++++------- examples/wasm_github_fetch/Cargo.toml | 4 +-- examples/wasm_github_fetch/src/lib.rs | 2 +- src/async_impl/body.rs | 3 +- src/async_impl/client.rs | 46 +++++++++++---------------- src/async_impl/h3_client/pool.rs | 2 +- src/async_impl/multipart.rs | 4 +-- src/async_impl/request.rs | 6 ++-- src/async_impl/response.rs | 4 +-- src/blocking/body.rs | 2 +- src/blocking/client.rs | 10 +++--- src/blocking/multipart.rs | 6 ++-- src/blocking/request.rs | 6 ++-- src/blocking/response.rs | 2 +- src/connect.rs | 30 ++++++----------- src/error.rs | 12 +++---- src/lib.rs | 4 +-- src/proxy.rs | 10 +++--- src/tls.rs | 11 +++---- tests/blocking.rs | 4 +-- tests/support/delay_server.rs | 3 +- tests/support/server.rs | 2 +- 23 files changed, 89 insertions(+), 118 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 408bccce0..78a770a2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: test: name: ${{ matrix.name }} - needs: [style] + needs: [ style ] runs-on: ${{ matrix.os || 'ubuntu-latest' }} @@ -203,7 +203,7 @@ jobs: unstable: name: "unstable features" - needs: [style] + needs: [ style ] runs-on: ubuntu-latest steps: - name: Checkout @@ -222,7 +222,7 @@ jobs: docs: name: Docs - needs: [test] + needs: [ test ] runs-on: ubuntu-latest steps: @@ -241,10 +241,10 @@ jobs: # job level. See `jobs.build.strategy.matrix`. nightly: name: linux / nightly - needs: [style] + needs: [ style ] # Use Ubuntu 20.04 here, because latest (22.04) uses OpenSSL v3. - # Currently OpenSSL v3 causes compile issues with openssl-sys + # Currently, OpenSSL v3 causes compile issues with openssl-sys runs-on: ubuntu-20.04 steps: @@ -274,7 +274,7 @@ jobs: msrv: name: MSRV - needs: [style] + needs: [ style ] runs-on: ubuntu-latest @@ -306,7 +306,7 @@ jobs: android: name: Android - needs: [style] + needs: [ style ] runs-on: ubuntu-latest @@ -325,7 +325,7 @@ jobs: wasm: name: WASM - needs: [style] + needs: [ style ] runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 221e7e5f8..003ff26f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,6 @@ - Add `Body::wrap()` to wrap any `http_body::Body` type. - Fix the pool configuration to use a timer to remove expired connections. - ## v0.12.7 - Revert adding `impl Service>` for `Client`. @@ -24,7 +23,7 @@ - Add `impl Service>` for `Client` and `&'_ Client`. - Add support for `!Sync` bodies in `Body::wrap_stream()`. - Enable happy eyeballs when `hickory-dns` is used. -- Fix `Proxy` so that `HTTP(S)_PROXY` values take precendence over `ALL_PROXY`. +- Fix `Proxy` so that `HTTP(S)_PROXY` values take precedence over `ALL_PROXY`. - Fix `blocking::RequestBuilder::header()` from unsetting `sensitive` on passed header values. ## v0.12.5 @@ -375,7 +374,6 @@ - Update `hyper` to v0.13. - Update `http` to v0.2. - ## v0.9.19 - Add `ClientBuilder::use_sys_proxy()` to enable automatic detect of HTTP proxies configured on the system. @@ -390,7 +388,7 @@ ## v0.9.17 -- Fix `Cookie` headers so as to not include attributes from the `Set-Cookie` (like `HttpOnly`, `Secure`, etc). +- Fix `Cookie` headers to not include attributes from the `Set-Cookie` (like `HttpOnly`, `Secure`, etc.) ## v0.9.16 @@ -409,8 +407,8 @@ - Add optional support for SOCKS5 proxies, by enabling the `socks5` cargo feature. - Add Cookie Store support to `Client`, automatically handling cookies for a session. -* Add `ClientBuilder::cookie_store(enable: bool)` method to enable a cookie store that persists across requests. -* Add `Response::cookies()` accessor that allows iterating over response cookies. +- Add `ClientBuilder::cookie_store(enable: bool)` method to enable a cookie store that persists across requests. +- Add `Response::cookies()` accessor that allows iterating over response cookies. - Fix `Proxy` to check the URL for a username and password. ## v0.9.13 @@ -490,7 +488,6 @@ - Removed timeout waiting for `reqwest::Client` runtime to startup. - Fix `RequestBuilder::headers` to properly append extra headers of the same name. - ### Performance - Replaced DNS threadpool using `getaddrinfo` with a non-blocking DNS resolver. @@ -536,7 +533,7 @@ - Fix large request bodies failing because of improper handling of backpressure. - Remove body-related headers when redirect changes a `POST` into a `GET`. -- Reduce memory size of `Response` and `Error` signicantly. +- Reduce memory size of `Response` and `Error` significantly. # v0.9.0 @@ -634,7 +631,6 @@ .send()?; ``` - ## v0.8.8 - Fix docs.rs/reqwest build. @@ -745,7 +741,7 @@ - Proxy support (#30) - Self-signed TLS certificates (#97) -- Disabling TLS hostname validation   (#89) +- Disabling TLS hostname validation (#89) - A `Request` type that can be used instead of the `RequestBuilder` (#85) - Add `Response::error_for_status()` to easily convert 400 and 500 status responses into an `Error` (#98) - Upgrade hyper to 0.11 @@ -758,7 +754,7 @@ ### Fixes - Publicly exports `RedirectAction` and `RedirectAttempt` -- `Error::get_ref` returns `Error + Send + Sync` +- `Error::get_ref` returns `Error + Send + Sync` ### Breaking Changes diff --git a/examples/wasm_github_fetch/Cargo.toml b/examples/wasm_github_fetch/Cargo.toml index 193370f22..9bf54a7e3 100644 --- a/examples/wasm_github_fetch/Cargo.toml +++ b/examples/wasm_github_fetch/Cargo.toml @@ -10,9 +10,9 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -reqwest = {path = "../../"} +reqwest = { path = "../.." } serde = { version = "1.0.101", features = ["derive"] } serde_derive = "^1.0.59" wasm-bindgen-futures = "0.4.1" serde_json = "1.0.41" -wasm-bindgen = { version = "0.2.51", features = ["serde-serialize"] } +wasm-bindgen = { version = "0.2.51", features = ["serde-serialize"] } diff --git a/examples/wasm_github_fetch/src/lib.rs b/examples/wasm_github_fetch/src/lib.rs index dc6b63623..b487344ed 100644 --- a/examples/wasm_github_fetch/src/lib.rs +++ b/examples/wasm_github_fetch/src/lib.rs @@ -4,7 +4,7 @@ use wasm_bindgen::prelude::*; // NOTE: This test is a clone of https://github.com/rustwasm/wasm-bindgen/blob/master/examples/fetch/src/lib.rs // but uses Reqwest instead of the web_sys fetch api directly -/// A struct to hold some data from the github Branch API. +/// A struct to hold some data from the GitHub Branch API. /// /// Note how we don't have to define every member -- serde will ignore extra /// data when deserializing diff --git a/src/async_impl/body.rs b/src/async_impl/body.rs index c2f1257c1..5160b2398 100644 --- a/src/async_impl/body.rs +++ b/src/async_impl/body.rs @@ -392,8 +392,7 @@ where } } -pub(crate) type ResponseBody = - http_body_util::combinators::BoxBody>; +pub(crate) type ResponseBody = BoxBody>; pub(crate) fn boxed(body: B) -> ResponseBody where diff --git a/src/async_impl/client.rs b/src/async_impl/client.rs index 579050041..a6267e3f7 100644 --- a/src/async_impl/client.rs +++ b/src/async_impl/client.rs @@ -429,7 +429,7 @@ impl ClientBuilder { // TLS v1.3. This would be entirely reasonable, // native-tls just doesn't support it. // https://github.com/sfackler/rust-native-tls/issues/140 - crate::error::builder("invalid minimum TLS version for backend") + error::builder("invalid minimum TLS version for backend") })?; tls.min_protocol_version(Some(protocol)); } @@ -440,7 +440,7 @@ impl ClientBuilder { // We could arguably do max_protocol_version(None), given // that 1.4 does not exist yet, but that'd get messy in the // future. - crate::error::builder("invalid maximum TLS version for backend") + error::builder("invalid maximum TLS version for backend") })?; tls.max_protocol_version(Some(protocol)); } @@ -534,15 +534,13 @@ impl ClientBuilder { Ok(_) => valid_count += 1, Err(err) => { invalid_count += 1; - log::debug!("rustls failed to parse DER certificate: {err:?}"); + debug!("rustls failed to parse DER certificate: {err:?}"); } } } if valid_count == 0 && invalid_count > 0 { let err = if load_results.errors.is_empty() { - crate::error::builder( - "zero valid certificates found in native root store", - ) + error::builder("zero valid certificates found in native root store") } else { use std::fmt::Write as _; let mut acc = String::new(); @@ -550,7 +548,7 @@ impl ClientBuilder { let _ = writeln!(&mut acc, "{err}"); } - crate::error::builder(acc) + error::builder(acc) }; return Err(err); @@ -581,7 +579,7 @@ impl ClientBuilder { } if versions.is_empty() { - return Err(crate::error::builder("empty supported tls versions")); + return Err(error::builder("empty supported tls versions")); } // Allow user to have installed a runtime default. @@ -601,7 +599,7 @@ impl ClientBuilder { let config_builder = rustls::ClientConfig::builder_with_provider(provider.clone()) .with_protocol_versions(&versions) - .map_err(|_| crate::error::builder("invalid TLS versions"))?; + .map_err(|_| error::builder("invalid TLS versions"))?; let config_builder = if !config.certs_verification { config_builder @@ -630,9 +628,7 @@ impl ClientBuilder { ) .with_crls(crls) .build() - .map_err(|_| { - crate::error::builder("invalid TLS verification settings") - })?; + .map_err(|_| error::builder("invalid TLS verification settings"))?; config_builder.with_webpki_verifier(verifier) } }; @@ -702,7 +698,7 @@ impl ClientBuilder { } #[cfg(any(feature = "native-tls", feature = "__rustls",))] TlsBackend::UnknownPreconfigured => { - return Err(crate::error::builder( + return Err(error::builder( "Unknown TLS backend passed to `use_preconfigured_tls`", )); } @@ -792,7 +788,7 @@ impl ClientBuilder { accepts: config.accepts, #[cfg(feature = "cookies")] cookie_store: config.cookie_store, - // Use match instead of map since config is partially moved + // Use match instead of map since config is partially moved, // and it cannot be used in closure #[cfg(feature = "http3")] h3_client: match h3_connector { @@ -846,7 +842,7 @@ impl ClientBuilder { self.config.headers.insert(USER_AGENT, value); } Err(e) => { - self.config.error = Some(crate::error::builder(e.into())); + self.config.error = Some(error::builder(e.into())); } }; self @@ -1639,7 +1635,7 @@ impl ClientBuilder { /// Set the minimum required TLS version for connections. /// - /// By default the TLS backend's own default is used. + /// By default, the TLS backend's own default is used. /// /// # Errors /// @@ -1668,7 +1664,7 @@ impl ClientBuilder { /// Set the maximum allowed TLS version for connections. /// - /// By default there's no maximum. + /// By default, there's no maximum. /// /// # Errors /// @@ -2610,7 +2606,7 @@ impl Future for PendingRequest { if let Some(delay) = self.as_mut().total_timeout().as_mut().as_pin_mut() { if let Poll::Ready(()) = delay.poll(cx) { return Poll::Ready(Err( - crate::error::request(crate::error::TimedOut).with_url(self.url.clone()) + error::request(error::TimedOut).with_url(self.url.clone()) )); } } @@ -2618,7 +2614,7 @@ impl Future for PendingRequest { if let Some(delay) = self.as_mut().read_timeout().as_mut().as_pin_mut() { if let Poll::Ready(()) = delay.poll(cx) { return Poll::Ready(Err( - crate::error::request(crate::error::TimedOut).with_url(self.url.clone()) + error::request(error::TimedOut).with_url(self.url.clone()) )); } } @@ -2631,9 +2627,7 @@ impl Future for PendingRequest { if self.as_mut().retry_error(&e) { continue; } - return Poll::Ready(Err( - crate::error::request(e).with_url(self.url.clone()) - )); + return Poll::Ready(Err(error::request(e).with_url(self.url.clone()))); } Poll::Ready(Ok(res)) => res.map(super::body::boxed), Poll::Pending => return Poll::Pending, @@ -2644,9 +2638,7 @@ impl Future for PendingRequest { if self.as_mut().retry_error(&e) { continue; } - return Poll::Ready(Err( - crate::error::request(e).with_url(self.url.clone()) - )); + return Poll::Ready(Err(error::request(e).with_url(self.url.clone()))); } Poll::Ready(Ok(res)) => res, Poll::Pending => return Poll::Pending, @@ -2694,7 +2686,7 @@ impl Future for PendingRequest { if should_redirect { let loc = res.headers().get(LOCATION).and_then(|val| { let loc = (|| -> Option { - // Some sites may send a utf-8 Location header, + // Some sites may send a UTF-8 Location header, // even though we're supposed to treat those bytes // as opaque, we'll check specifically for utf8. self.url.join(str::from_utf8(val.as_bytes()).ok()?).ok() @@ -2797,7 +2789,7 @@ impl Future for PendingRequest { debug!("redirect policy disallowed redirection to '{loc}'"); } redirect::ActionKind::Error(err) => { - return Poll::Ready(Err(crate::error::redirect(err, self.url.clone()))); + return Poll::Ready(Err(error::redirect(err, self.url.clone()))); } } } diff --git a/src/async_impl/h3_client/pool.rs b/src/async_impl/h3_client/pool.rs index 100a0935d..01f3ebee6 100644 --- a/src/async_impl/h3_client/pool.rs +++ b/src/async_impl/h3_client/pool.rs @@ -39,7 +39,7 @@ impl Pool { if !inner.connecting.insert(key.clone()) { return Err(format!("HTTP/3 connecting already in progress for {key:?}").into()); } - return Ok(()); + Ok(()) } pub fn try_pool(&self, key: &Key) -> Option { diff --git a/src/async_impl/multipart.rs b/src/async_impl/multipart.rs index df4dc1272..b016044d3 100644 --- a/src/async_impl/multipart.rs +++ b/src/async_impl/multipart.rs @@ -417,7 +417,7 @@ impl FormParts

{ _ => return None, } } - // If there is a at least one field there is a special boundary for the very last field. + // If there is at least one field there is a special boundary for the very last field. if !self.fields.is_empty() { length += 2 + self.boundary().len() as u64 + 4 } @@ -703,7 +703,7 @@ mod tests { let stream_len = stream_data.len(); let stream_data = stream_data .chunks(3) - .map(|c| Ok::<_, std::io::Error>(Bytes::from(c))); + .map(|c| Ok::<_, io::Error>(Bytes::from(c))); let the_stream = futures_util::stream::iter(stream_data); let bytes_data = b"some bytes data".to_vec(); diff --git a/src/async_impl/request.rs b/src/async_impl/request.rs index 76b40a788..2f732f5ef 100644 --- a/src/async_impl/request.rs +++ b/src/async_impl/request.rs @@ -181,7 +181,7 @@ impl RequestBuilder { pub fn from_parts(client: Client, request: Request) -> RequestBuilder { RequestBuilder { client, - request: crate::Result::Ok(request), + request: Ok(request), } } @@ -209,7 +209,7 @@ impl RequestBuilder { match >::try_from(key) { Ok(key) => match >::try_from(value) { Ok(mut value) => { - // We want to potentially make an unsensitive header + // We want to potentially make an non-sensitive header // to be sensitive, not the reverse. So, don't turn off // a previously sensitive header. if sensitive { @@ -231,7 +231,7 @@ impl RequestBuilder { /// Add a set of Headers to the existing ones on this Request. /// /// The headers will be merged in to any already set. - pub fn headers(mut self, headers: crate::header::HeaderMap) -> RequestBuilder { + pub fn headers(mut self, headers: HeaderMap) -> RequestBuilder { if let Ok(ref mut req) = self.request { crate::util::replace_headers(req.headers_mut(), headers); } diff --git a/src/async_impl/response.rs b/src/async_impl/response.rs index 23e30d3ed..4eb8ef59a 100644 --- a/src/async_impl/response.rs +++ b/src/async_impl/response.rs @@ -257,7 +257,7 @@ impl Response { /// /// # Errors /// - /// This method fails whenever the response body is not in JSON format + /// This method fails whenever the response body is not in JSON format, /// or it cannot be properly deserialized to target type `T`. For more /// details please see [`serde_json::from_reader`]. /// @@ -453,7 +453,7 @@ impl> From> for Response { use crate::response::ResponseUrl; let (mut parts, body) = r.into_parts(); - let body: crate::async_impl::body::Body = body.into(); + let body: Body = body.into(); let decoder = Decoder::detect( &mut parts.headers, ResponseBody::new(body.map_err(Into::into)), diff --git a/src/blocking/body.rs b/src/blocking/body.rs index 4782b368c..805009eae 100644 --- a/src/blocking/body.rs +++ b/src/blocking/body.rs @@ -296,7 +296,7 @@ async fn send_future(sender: Sender) -> Result<(), crate::Error> { // // We need to know whether there is any data to send before // we check the transmission channel (with poll_ready below) - // because sometimes the receiver disappears as soon as is + // because sometimes the receiver disappears as soon as it // considers the data is completely transmitted, which may // be true. // diff --git a/src/blocking/client.rs b/src/blocking/client.rs index 73f25208f..4d1d07d7d 100644 --- a/src/blocking/client.rs +++ b/src/blocking/client.rs @@ -201,7 +201,7 @@ impl ClientBuilder { /// Enable auto gzip decompression by checking the `Content-Encoding` response header. /// - /// If auto gzip decompresson is turned on: + /// If auto gzip decompression is turned on: /// /// - When sending a request and if the request's headers do not already contain /// an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `gzip`. @@ -267,7 +267,7 @@ impl ClientBuilder { /// Enable auto deflate decompression by checking the `Content-Encoding` response header. /// - /// If auto deflate decompresson is turned on: + /// If auto deflate decompression is turned on: /// /// - When sending a request and if the request's headers do not already contain /// an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `deflate`. @@ -353,7 +353,7 @@ impl ClientBuilder { /// Clear all `Proxies`, so `Client` will use no proxy anymore. /// /// # Note - /// To add a proxy exclusion list, use [crate::proxy::Proxy::no_proxy()] + /// To add a proxy exclusion list, use [Proxy::no_proxy()] /// on all desired proxies instead. /// /// This also disables the automatic usage of the "system" proxy. @@ -765,7 +765,7 @@ impl ClientBuilder { /// Set the minimum required TLS version for connections. /// - /// By default the TLS backend's own default is used. + /// By default, the TLS backend's own default is used. /// /// # Errors /// @@ -793,7 +793,7 @@ impl ClientBuilder { /// Set the maximum allowed TLS version for connections. /// - /// By default there's no maximum. + /// By default, there's no maximum. /// /// # Errors /// diff --git a/src/blocking/multipart.rs b/src/blocking/multipart.rs index 4f18a2aae..47904229f 100644 --- a/src/blocking/multipart.rs +++ b/src/blocking/multipart.rs @@ -149,7 +149,7 @@ impl Form { } // If predictable, computes the length the request will have - // The length should be preditable if only String and file fields have been added, + // The length should be predictable if only String and file fields have been added, // but not if a generic reader has been added; pub(crate) fn compute_length(&mut self) -> Option { self.inner.compute_length() @@ -391,10 +391,10 @@ mod tests { fn read_to_end() { let mut output = Vec::new(); let mut form = Form::new() - .part("reader1", Part::reader(std::io::empty())) + .part("reader1", Part::reader(io::empty())) .part("key1", Part::text("value1")) .part("key2", Part::text("value2").mime(mime::IMAGE_BMP)) - .part("reader2", Part::reader(std::io::empty())) + .part("reader2", Part::reader(io::empty())) .part("key3", Part::text("value3").file_name("filename")); form.inner.boundary = "boundary".to_string(); let length = form.compute_length(); diff --git a/src/blocking/request.rs b/src/blocking/request.rs index 8ac112444..6e866e0d6 100644 --- a/src/blocking/request.rs +++ b/src/blocking/request.rs @@ -171,7 +171,7 @@ impl RequestBuilder { pub fn from_parts(client: Client, request: Request) -> RequestBuilder { RequestBuilder { client, - request: crate::Result::Ok(request), + request: Ok(request), } } @@ -255,7 +255,7 @@ impl RequestBuilder { /// # Ok(()) /// # } /// ``` - pub fn headers(mut self, headers: crate::header::HeaderMap) -> RequestBuilder { + pub fn headers(mut self, headers: HeaderMap) -> RequestBuilder { if let Ok(ref mut req) = self.request { crate::util::replace_headers(req.headers_mut(), headers); } @@ -614,7 +614,7 @@ impl RequestBuilder { /// # } /// ``` /// - /// With a non-clonable body + /// With a non-cloneable body /// /// ```rust /// # fn run() -> Result<(), Box> { diff --git a/src/blocking/response.rs b/src/blocking/response.rs index 1a4685115..3c2e1d879 100644 --- a/src/blocking/response.rs +++ b/src/blocking/response.rs @@ -230,7 +230,7 @@ impl Response { /// /// # Errors /// - /// This method fails whenever the response body is not in JSON format + /// This method fails whenever the response body is not in JSON format, /// or it cannot be properly deserialized to target type `T`. For more /// details please see [`serde_json::from_reader`]. /// diff --git a/src/connect.rs b/src/connect.rs index ff86ba3c9..3da5e1bcb 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -464,7 +464,7 @@ impl Connector { fn into_uri(scheme: Scheme, host: Authority) -> Uri { // TODO: Should the `http` crate get `From<(Scheme, Authority)> for Uri`? - http::Uri::builder() + Uri::builder() .scheme(scheme) .authority(host) .path_and_query(http::uri::PathAndQuery::from_static("/")) @@ -857,7 +857,7 @@ mod native_tls_conn { self: Pin<&mut Self>, cx: &mut Context, buf: ReadBufCursor<'_>, - ) -> Poll> { + ) -> Poll> { let this = self.project(); Read::poll_read(this.inner, cx, buf) } @@ -868,7 +868,7 @@ mod native_tls_conn { self: Pin<&mut Self>, cx: &mut Context, buf: &[u8], - ) -> Poll> { + ) -> Poll> { let this = self.project(); Write::poll_write(this.inner, cx, buf) } @@ -886,18 +886,12 @@ mod native_tls_conn { self.inner.is_write_vectored() } - fn poll_flush( - self: Pin<&mut Self>, - cx: &mut Context, - ) -> Poll> { + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { let this = self.project(); Write::poll_flush(this.inner, cx) } - fn poll_shutdown( - self: Pin<&mut Self>, - cx: &mut Context, - ) -> Poll> { + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { let this = self.project(); Write::poll_shutdown(this.inner, cx) } @@ -972,7 +966,7 @@ mod rustls_tls_conn { self: Pin<&mut Self>, cx: &mut Context, buf: ReadBufCursor<'_>, - ) -> Poll> { + ) -> Poll> { let this = self.project(); Read::poll_read(this.inner, cx, buf) } @@ -983,7 +977,7 @@ mod rustls_tls_conn { self: Pin<&mut Self>, cx: &mut Context, buf: &[u8], - ) -> Poll> { + ) -> Poll> { let this = self.project(); Write::poll_write(this.inner, cx, buf) } @@ -1001,18 +995,12 @@ mod rustls_tls_conn { self.inner.is_write_vectored() } - fn poll_flush( - self: Pin<&mut Self>, - cx: &mut Context, - ) -> Poll> { + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { let this = self.project(); Write::poll_flush(this.inner, cx) } - fn poll_shutdown( - self: Pin<&mut Self>, - cx: &mut Context, - ) -> Poll> { + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { let this = self.project(); Write::poll_shutdown(this.inner, cx) } diff --git a/src/error.rs b/src/error.rs index ca7413fd6..1d261694f 100644 --- a/src/error.rs +++ b/src/error.rs @@ -346,7 +346,7 @@ mod tests { let root = Error::new(Kind::Request, None::); assert!(root.source().is_none()); - let link = super::body(root); + let link = body(root); assert!(link.source().is_some()); assert_send::(); assert_sync::(); @@ -360,11 +360,11 @@ mod tests { #[test] fn roundtrip_io_error() { - let orig = super::request("orig"); + let orig = request("orig"); // Convert reqwest::Error into an io::Error... let io = orig.into_io(); // Convert that io::Error back into a reqwest::Error... - let err = super::decode_io(io); + let err = decode_io(io); // It should have pulled out the original, not nested it... match err.inner.kind { Kind::Request => (), @@ -375,7 +375,7 @@ mod tests { #[test] fn from_unknown_io_error() { let orig = io::Error::new(io::ErrorKind::Other, "orly"); - let err = super::decode_io(orig); + let err = decode_io(orig); match err.inner.kind { Kind::Decode => (), _ => panic!("{err:?}"), @@ -384,11 +384,11 @@ mod tests { #[test] fn is_timeout() { - let err = super::request(super::TimedOut); + let err = request(TimedOut); assert!(err.is_timeout()); let io = io::Error::new(io::ErrorKind::Other, err); - let nested = super::request(io); + let nested = request(io); assert!(nested.is_timeout()); } } diff --git a/src/lib.rs b/src/lib.rs index cf3d39d0f..4f4203c9b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -237,7 +237,7 @@ //! [get]: ./fn.get.html //! [builder]: ./struct.RequestBuilder.html //! [serde]: http://serde.rs -//! [redirect]: crate::redirect +//! [redirect]: redirect //! [Proxy]: ./struct.Proxy.html //! [cargo-features]: https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-features-section //! [sponsor]: https://seanmonstar.com/sponsor @@ -306,7 +306,7 @@ pub use self::response::ResponseBuilderExt; /// - supplied `Url` cannot be parsed /// - there was an error while sending request /// - redirect limit was exhausted -pub async fn get(url: T) -> crate::Result { +pub async fn get(url: T) -> Result { Client::builder().build()?.get(url).send().await } diff --git a/src/proxy.rs b/src/proxy.rs index dd3d30b2a..43d7acbe0 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -437,7 +437,7 @@ impl fmt::Debug for Proxy { impl NoProxy { /// Returns a new no-proxy configuration based on environment variables (or `None` if no variables are set) - /// see [self::NoProxy::from_string()] for the string format + /// see [NoProxy::from_string()] for the string format pub fn from_env() -> Option { let raw = env::var("NO_PROXY") .or_else(|_| env::var("no_proxy")) @@ -458,7 +458,7 @@ impl NoProxy { /// * Any other entry is considered a domain name (and may contain a leading dot, for example `google.com` /// and `.google.com` are equivalent) and would match both that domain AND all subdomains. /// - /// For example, if `"NO_PROXY=google.com, 192.168.1.0/24"` was set, all of the following would match + /// For example, if `"NO_PROXY=google.com, 192.168.1.0/24"` was set, all the following would match /// (and therefore would bypass the proxy): /// * `http://google.com/` /// * `http://www.google.com/` @@ -872,7 +872,7 @@ impl Dst for Uri { /// /// All platforms will check for proxy settings via environment variables. /// If those aren't set, platform-wide proxy settings will be looked up on -/// Windows and MacOS platforms instead. Errors encountered while discovering +/// Windows and macOS platforms instead. Errors encountered while discovering /// these settings are ignored. /// /// Returns: @@ -956,7 +956,7 @@ fn is_cgi() -> bool { fn get_from_platform_impl() -> Result, Box> { let internet_setting = windows_registry::CURRENT_USER .open("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")?; - // ensure the proxy is enable, if the value doesn't exist, an error will returned. + // ensure the proxy is enabled, if the value doesn't exist, an error will be returned. let proxy_enable = internet_setting.get_u32("ProxyEnable")?; let proxy_server = internet_setting.get_string("ProxyServer")?; @@ -1146,7 +1146,7 @@ mod tests { #[cfg(feature = "socks")] _ => panic!("intercepted as socks"), }; - http::Uri::builder() + Uri::builder() .scheme(scheme) .authority(host) .path_and_query("/") diff --git a/src/tls.rs b/src/tls.rs index 0422b1c7d..83820302d 100644 --- a/src/tls.rs +++ b/src/tls.rs @@ -204,10 +204,7 @@ impl Certificate { } #[cfg(feature = "__rustls")] - pub(crate) fn add_to_rustls( - self, - root_cert_store: &mut rustls::RootCertStore, - ) -> crate::Result<()> { + pub(crate) fn add_to_rustls(self, root_cert_store: &mut RootCertStore) -> crate::Result<()> { use std::io::Cursor; match self.original { @@ -282,7 +279,7 @@ impl Identity { /// Parses a chain of PEM encoded X509 certificates, with the leaf certificate first. /// `key` is a PEM encoded PKCS #8 formatted private key for the leaf certificate. /// - /// The certificate chain should contain any intermediate cerficates that should be sent to + /// The certificate chain should contain any intermediate certificates that should be sent to /// clients to allow them to build a chain to a trusted root. /// /// A certificate chain here means a series of PEM encoded certificates concatenated together. @@ -736,8 +733,8 @@ impl TlsInfo { } } -impl std::fmt::Debug for TlsInfo { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl fmt::Debug for TlsInfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("TlsInfo").finish() } } diff --git a/tests/blocking.rs b/tests/blocking.rs index 1125cddf1..4f22ea27c 100644 --- a/tests/blocking.rs +++ b/tests/blocking.rs @@ -159,7 +159,7 @@ fn test_post_form() { } /// Calling `Response::error_for_status`` on a response with status in 4xx -/// returns a error. +/// returns an error. #[test] fn test_error_for_status_4xx() { let server = server::http(move |_req| async { @@ -178,7 +178,7 @@ fn test_error_for_status_4xx() { } /// Calling `Response::error_for_status`` on a response with status in 5xx -/// returns a error. +/// returns an error. #[test] fn test_error_for_status_5xx() { let server = server::http(move |_req| async { diff --git a/tests/support/delay_server.rs b/tests/support/delay_server.rs index f79c2a4df..521e1e023 100644 --- a/tests/support/delay_server.rs +++ b/tests/support/delay_server.rs @@ -44,8 +44,7 @@ impl Server { let addr = tcp_listener.local_addr().unwrap(); tokio::spawn(async move { - let mut builder = - hyper_util::server::conn::auto::Builder::new(hyper_util::rt::TokioExecutor::new()); + let mut builder = Builder::new(hyper_util::rt::TokioExecutor::new()); apply_config(&mut builder); tokio::spawn(async move { diff --git a/tests/support/server.rs b/tests/support/server.rs index 29835ead1..f2f092546 100644 --- a/tests/support/server.rs +++ b/tests/support/server.rs @@ -91,7 +91,7 @@ where .spawn(move || { rt.block_on(async move { let mut builder = - hyper_util::server::conn::auto::Builder::new(hyper_util::rt::TokioExecutor::new()); + Builder::new(hyper_util::rt::TokioExecutor::new()); apply_config(&mut builder); loop {