Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix spelling errors #775

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions guides/building-a-middleware-from-scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ means we can combine multiple errors type into one. That has the following
advantages:

1. Our error handling is less fragile since changing the order middleware are
applied in wont change the final error type.
applied in won't change the final error type.
2. The error type now has a constant size regardless how many middleware we've
applied.
3. Extracting the error no longer requires a big `match` but can instead be done
Expand All @@ -412,7 +412,7 @@ For our `Timeout` middleware that means we need to create a struct that
implements `std::error::Error` such that we can convert it into a `Box<dyn
std::error::Error + Send + Sync>`. We also have to require that the inner
service's error type implements `Into<Box<dyn std::error::Error + Send +
Sync>>`. Luckily most errors automatically satisfies that so it wont require
Sync>>`. Luckily most errors automatically satisfies that so it won't require
users to write any additional code. We're using `Into` for the trait bound
rather than `From` as recommend by the [standard
library](https://doc.rust-lang.org/stable/std/convert/trait.From.html).
Expand Down Expand Up @@ -521,7 +521,7 @@ where

## Conclusion

Thats it! We've now successfully implemented the `Timeout` middleware as it
That's it! We've now successfully implemented the `Timeout` middleware as it
exists in Tower today.

Our final implementation is:
Expand Down
2 changes: 1 addition & 1 deletion tower/src/balance/p2c/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! Since the load balancer needs to perform _random_ choices, the constructors in this module
//! usually come in two forms: one that uses randomness provided by the operating system, and one
//! that lets you specify the random seed to use. Usually the former is what you'll want, though
//! the latter may come in handy for reproducability or to reduce reliance on the operating system.
//! the latter may come in handy for reproducibility or to reduce reliance on the operating system.
//!
//! [Power of Two Random Choices]: http://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf
//! [finagle]: https://twitter.github.io/finagle/guide/Clients.html#power-of-two-choices-p2c-least-loaded
Expand Down
2 changes: 1 addition & 1 deletion tower/src/ready_cache/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use tracing::{debug, trace};
/// in the ready set. The `ReadyCache::check_*` functions can be used to ensure
/// that a service is ready before dispatching a request.
///
/// The ready set can hold services for an abitrarily long time. During this
/// The ready set can hold services for an arbitrarily long time. During this
/// time, the runtime may process events that invalidate that ready state (for
/// instance, if a keepalive detects a lost connection). In such cases, callers
/// should use [`ReadyCache::check_ready`] (or [`ReadyCache::check_ready_index`])
Expand Down
2 changes: 1 addition & 1 deletion tower/src/steer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ where
///
/// An example use case is a sharded service.
/// It accepts new requests, then:
/// 1. Determines, via the provided [`Picker`], which [`Service`] the request coresponds to.
/// 1. Determines, via the provided [`Picker`], which [`Service`] the request corresponds to.
/// 2. Waits (in [`Service::poll_ready`]) for *all* services to be ready.
/// 3. Calls the correct [`Service`] with the request, and returns a future corresponding to the
/// call.
Expand Down
2 changes: 1 addition & 1 deletion tower/src/util/call_all/ordered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/// reqs.unbounded_send("three").unwrap();
/// drop(reqs);
///
/// // We then loop over the response Strem that we get back from call_all.
/// // We then loop over the response `Stream` that we get back from call_all.
/// let mut i = 0usize;
/// while let Some(rsp) = rsps.next().await {
/// // Each response is a Result (we could also have used TryStream::try_next)
Expand Down Expand Up @@ -168,7 +168,7 @@
}

fn push(&mut self, future: F) {
FuturesOrdered::push(self, future)

Check warning on line 171 in tower/src/util/call_all/ordered.rs

View workflow job for this annotation

GitHub Actions / check-stable

use of deprecated method `futures_util::stream::FuturesOrdered::<Fut>::push`: use `push_back` instead

Check warning on line 171 in tower/src/util/call_all/ordered.rs

View workflow job for this annotation

GitHub Actions / test-versions (stable)

use of deprecated method `futures_util::stream::FuturesOrdered::<Fut>::push`: use `push_back` instead

Check warning on line 171 in tower/src/util/call_all/ordered.rs

View workflow job for this annotation

GitHub Actions / test-versions (nightly)

use of deprecated method `futures_util::stream::FuturesOrdered::<Fut>::push`: use `push_back` instead

Check warning on line 171 in tower/src/util/call_all/ordered.rs

View workflow job for this annotation

GitHub Actions / test-versions (beta)

use of deprecated method `futures_util::stream::FuturesOrdered::<Fut>::push`: use `push_back` instead
}

fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Option<F::Output>> {
Expand Down
10 changes: 5 additions & 5 deletions tower/src/util/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
// Borrowed from:
// https://github.com/rust-random/rand/blob/master/src/distributions/float.rs#L106
let float_size = std::mem::size_of::<f64>() as u32 * 8;
let precison = 52 + 1;
let scale = 1.0 / ((1u64 << precison) as f64);
let precision = 52 + 1;
let scale = 1.0 / ((1u64 << precision) as f64);

let value = self.next_u64();
let value = value >> (float_size - precison);
let value = value >> (float_size - precision);

scale * value as f64
}
Expand Down Expand Up @@ -111,8 +111,8 @@

/// A sampler modified from the Rand implementation for use internally for the balance middleware.
///
/// It's an implementation of Floyd's combination algorithm. with amount fixed at 2. This uses no allocated
/// memory and finishes in constant time (only 2 random calls)
/// It's an implementation of Floyd's combination algorithm with amount fixed at 2. This uses no allocated
/// memory and finishes in constant time (only 2 random calls).
///
/// ref: This was borrowed and modified from the following Rand implementation
/// https://github.com/rust-random/rand/blob/b73640705d6714509f8ceccc49e8df996fa19f51/src/seq/index.rs#L375-L411
Expand Down Expand Up @@ -174,7 +174,7 @@
let mut r = HasherRng::default();
match super::sample_floyd2(&mut r, 2) {
[0, 1] | [1, 0] => (),
err => panic!("{err:?}"),

Check warning on line 177 in tower/src/util/rng.rs

View workflow job for this annotation

GitHub Actions / check-stable

panic message contains an unused formatting placeholder

Check warning on line 177 in tower/src/util/rng.rs

View workflow job for this annotation

GitHub Actions / test-versions (stable)

panic message contains an unused formatting placeholder

Check warning on line 177 in tower/src/util/rng.rs

View workflow job for this annotation

GitHub Actions / test-versions (nightly)

panic message contains an unused formatting placeholder

Check warning on line 177 in tower/src/util/rng.rs

View workflow job for this annotation

GitHub Actions / test-versions (beta)

panic message contains an unused formatting placeholder

Check warning on line 177 in tower/src/util/rng.rs

View workflow job for this annotation

GitHub Actions / check-msrv

unused variable: `err`

Check warning on line 177 in tower/src/util/rng.rs

View workflow job for this annotation

GitHub Actions / check-msrv

panic message contains an unused formatting placeholder
}
}
}
Loading