Skip to content

Commit

Permalink
spelling cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Nov 12, 2024
1 parent e2d4b14 commit 490c72e
Show file tree
Hide file tree
Showing 23 changed files with 171 additions and 160 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

test:
name: ${{ matrix.name }}
needs: [style]
needs: [ style ]

runs-on: ${{ matrix.os || 'ubuntu-latest' }}

Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:

unstable:
name: "unstable features"
needs: [style]
needs: [ style ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -222,7 +222,7 @@ jobs:

docs:
name: Docs
needs: [test]
needs: [ test ]
runs-on: ubuntu-latest

steps:
Expand All @@ -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:
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
msrv:
name: MSRV
needs: [style]
needs: [ style ]

runs-on: ubuntu-latest

Expand Down Expand Up @@ -306,7 +306,7 @@ jobs:

android:
name: Android
needs: [style]
needs: [ style ]

runs-on: ubuntu-latest

Expand All @@ -325,7 +325,7 @@ jobs:

wasm:
name: WASM
needs: [style]
needs: [ style ]

runs-on: ubuntu-latest

Expand Down
142 changes: 89 additions & 53 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/wasm_github_fetch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
2 changes: 1 addition & 1 deletion examples/wasm_github_fetch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/async_impl/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ where
}
}

pub(crate) type ResponseBody =
http_body_util::combinators::BoxBody<Bytes, Box<dyn std::error::Error + Send + Sync>>;
pub(crate) type ResponseBody = BoxBody<Bytes, Box<dyn std::error::Error + Send + Sync>>;

pub(crate) fn boxed<B>(body: B) -> ResponseBody
where
Expand Down
46 changes: 19 additions & 27 deletions src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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));
}
Expand Down Expand Up @@ -534,23 +534,21 @@ 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();
for err in load_results.errors {
let _ = writeln!(&mut acc, "{err}");
}

crate::error::builder(acc)
error::builder(acc)
};

return Err(err);
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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)
}
};
Expand Down Expand Up @@ -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`",
));
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
///
Expand Down Expand Up @@ -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
///
Expand Down Expand Up @@ -2610,15 +2606,15 @@ 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())
));
}
}

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())
));
}
}
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -2694,7 +2686,7 @@ impl Future for PendingRequest {
if should_redirect {
let loc = res.headers().get(LOCATION).and_then(|val| {
let loc = (|| -> Option<Url> {
// 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()
Expand Down Expand Up @@ -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())));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/async_impl/h3_client/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PoolClient> {
Expand Down
4 changes: 2 additions & 2 deletions src/async_impl/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl<P: PartProps> FormParts<P> {
_ => 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
}
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/async_impl/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -209,7 +209,7 @@ impl RequestBuilder {
match <HeaderName as TryFrom<K>>::try_from(key) {
Ok(key) => match <HeaderValue as TryFrom<V>>::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 {
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/async_impl/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`].
///
Expand Down Expand Up @@ -453,7 +453,7 @@ impl<T: Into<Body>> From<http::Response<T>> 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)),
Expand Down
2 changes: 1 addition & 1 deletion src/blocking/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
Loading

0 comments on commit 490c72e

Please sign in to comment.