From 8a7782c3644292aec17904009f84bdd678f91840 Mon Sep 17 00:00:00 2001 From: glendc Date: Mon, 22 Jul 2024 13:55:36 +0200 Subject: [PATCH 1/3] fix warnings found when running check/doc commands --- tower/src/lib.rs | 5 ++--- tower/src/load/pending_requests.rs | 1 + tower/src/util/call_all/ordered.rs | 2 +- tower/src/util/rng.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tower/src/lib.rs b/tower/src/lib.rs index a509b89cb..003ebcee6 100644 --- a/tower/src/lib.rs +++ b/tower/src/lib.rs @@ -22,7 +22,7 @@ //! response or an error. This abstraction can be used to model both clients and //! servers. //! -//! Generic components, like [timeouts], [rate limiting], and [load balancing], +//! Generic components, like [`timeout`], [rate limiting], and [load balancing], //! can be modeled as [`Service`]s that wrap some inner service and apply //! additional behavior before or after the inner service is called. This allows //! implementing these components in a protocol-agnostic, composable way. Typically, @@ -130,7 +130,7 @@ //! ``` //! //! Alternatively, you can only enable some features. For example, to enable -//! only the [`retry`] and [`timeout`][timeouts] middleware, write: +//! only the [`retry`] and [`timeout`] middleware, write: //! //! ```toml //! tower = { version = "0.4", features = ["retry", "timeout"] } @@ -148,7 +148,6 @@ //! //! [`Service`]: crate::Service //! [`Layer`]: crate::Layer -//! [timeouts]: crate::timeout //! [rate limiting]: crate::limit::rate //! [load balancing]: crate::balance //! [`ServiceBuilder`]: crate::ServiceBuilder diff --git a/tower/src/load/pending_requests.rs b/tower/src/load/pending_requests.rs index 2b30de8dd..2721633fd 100644 --- a/tower/src/load/pending_requests.rs +++ b/tower/src/load/pending_requests.rs @@ -45,6 +45,7 @@ pub struct Count(usize); /// Tracks an in-flight request by reference count. #[derive(Debug)] +#[allow(dead_code)] pub struct Handle(RefCount); // ===== impl PendingRequests ===== diff --git a/tower/src/util/call_all/ordered.rs b/tower/src/util/call_all/ordered.rs index ba8310016..9a283916b 100644 --- a/tower/src/util/call_all/ordered.rs +++ b/tower/src/util/call_all/ordered.rs @@ -168,7 +168,7 @@ impl common::Drive for FuturesOrdered { } fn push(&mut self, future: F) { - FuturesOrdered::push(self, future) + FuturesOrdered::push_back(self, future) } fn poll(&mut self, cx: &mut Context<'_>) -> Poll> { diff --git a/tower/src/util/rng.rs b/tower/src/util/rng.rs index de9975661..9b6d307d9 100644 --- a/tower/src/util/rng.rs +++ b/tower/src/util/rng.rs @@ -174,7 +174,7 @@ mod tests { let mut r = HasherRng::default(); match super::sample_floyd2(&mut r, 2) { [0, 1] | [1, 0] => (), - err => panic!("{err:?}"), + array => panic!("unexpected inplace boundaries: {:?}", array), } } } From d93a592c67acae5b93dbf633196a5452c463c484 Mon Sep 17 00:00:00 2001 From: glendc Date: Mon, 22 Jul 2024 14:01:24 +0200 Subject: [PATCH 2/3] push_back was only added in 0.3.22 of futures --- examples/Cargo.toml | 4 ++-- tower-service/Cargo.toml | 2 +- tower/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index a39ddb9ca..a2d304887 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -8,11 +8,11 @@ edition = "2018" # [dependencies] instead. [dev-dependencies] tower = { version = "0.4", path = "../tower", features = ["full"] } -tower-service = "0.3" +tower-service = "0.3" tokio = { version = "1.0", features = ["full"] } rand = "0.8" pin-project = "1.0" -futures = "0.3" +futures = "^0.3.22" tracing = "0.1" tracing-subscriber = "0.2" hdrhistogram = "7" diff --git a/tower-service/Cargo.toml b/tower-service/Cargo.toml index 68a5a8768..cdd2ede32 100644 --- a/tower-service/Cargo.toml +++ b/tower-service/Cargo.toml @@ -25,4 +25,4 @@ edition = "2018" http = "0.2" tower-layer = { version = "0.3", path = "../tower-layer" } tokio = { version = "1", features = ["macros", "time"] } -futures = "0.3" +futures = "^0.3.22" diff --git a/tower/Cargo.toml b/tower/Cargo.toml index 3e199a844..b477e4c34 100644 --- a/tower/Cargo.toml +++ b/tower/Cargo.toml @@ -81,7 +81,7 @@ pin-project-lite = { version = "0.2.7", optional = true } sync_wrapper = { version = "0.1.1", optional = true } [dev-dependencies] -futures = "0.3" +futures = "^0.3.22" hdrhistogram = { version = "7.0", default-features = false } pin-project-lite = "0.2.7" tokio = { version = "1.6.2", features = ["macros", "sync", "test-util", "rt-multi-thread"] } From e18bff203d36ff5f69336b7eac906f2ba58d8e6d Mon Sep 17 00:00:00 2001 From: glendc Date: Mon, 22 Jul 2024 15:42:45 +0200 Subject: [PATCH 3/3] remove leading carrot --- examples/Cargo.toml | 2 +- tower-service/Cargo.toml | 2 +- tower/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index a2d304887..b8faa4622 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -12,7 +12,7 @@ tower-service = "0.3" tokio = { version = "1.0", features = ["full"] } rand = "0.8" pin-project = "1.0" -futures = "^0.3.22" +futures = "0.3.22" tracing = "0.1" tracing-subscriber = "0.2" hdrhistogram = "7" diff --git a/tower-service/Cargo.toml b/tower-service/Cargo.toml index cdd2ede32..6fc60f758 100644 --- a/tower-service/Cargo.toml +++ b/tower-service/Cargo.toml @@ -25,4 +25,4 @@ edition = "2018" http = "0.2" tower-layer = { version = "0.3", path = "../tower-layer" } tokio = { version = "1", features = ["macros", "time"] } -futures = "^0.3.22" +futures = "0.3.22" diff --git a/tower/Cargo.toml b/tower/Cargo.toml index b477e4c34..4cd140e7c 100644 --- a/tower/Cargo.toml +++ b/tower/Cargo.toml @@ -81,7 +81,7 @@ pin-project-lite = { version = "0.2.7", optional = true } sync_wrapper = { version = "0.1.1", optional = true } [dev-dependencies] -futures = "^0.3.22" +futures = "0.3.22" hdrhistogram = { version = "7.0", default-features = false } pin-project-lite = "0.2.7" tokio = { version = "1.6.2", features = ["macros", "sync", "test-util", "rt-multi-thread"] }