Skip to content

Commit 6a3ab07

Browse files
authored
style: address clippy lints (#827)
1 parent ec81e57 commit 6a3ab07

File tree

12 files changed

+35
-32
lines changed

12 files changed

+35
-32
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ lazy_static = "1.4.0"
1818
pin-project-lite = "0.2.7"
1919
quickcheck = "1"
2020
rand = "0.8"
21-
slab = "0.4"
21+
slab = "0.4.9"
2222
sync_wrapper = "1"
2323
tokio = "1.6.2"
2424
tokio-stream = "0.1.0"

tower-layer/src/layer_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ mod tests {
109109

110110
assert_eq!(
111111
"LayerFn { f: tower_layer::layer_fn::tests::layer_fn_has_useful_debug_impl::{{closure}} }".to_string(),
112-
format!("{:?}", layer),
112+
format!("{layer:?}"),
113113
);
114114
}
115115
}

tower-layer/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub trait Layer<S> {
105105
fn layer(&self, inner: S) -> Self::Service;
106106
}
107107

108-
impl<'a, T, S> Layer<S> for &'a T
108+
impl<T, S> Layer<S> for &T
109109
where
110110
T: ?Sized + Layer<S>,
111111
{

tower-test/src/mock/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use std::{
1818
future::Future,
1919
sync::{Arc, Mutex},
2020
task::{Context, Poll},
21-
u64,
2221
};
2322

2423
/// Spawn a layer onto a mock service.

tower/examples/tower-balance.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ struct Summary {
4646
async fn main() {
4747
tracing::subscriber::set_global_default(tracing_subscriber::FmtSubscriber::default()).unwrap();
4848

49-
println!("REQUESTS={}", REQUESTS);
50-
println!("CONCURRENCY={}", CONCURRENCY);
51-
println!("ENDPOINT_CAPACITY={}", ENDPOINT_CAPACITY);
49+
println!("REQUESTS={REQUESTS}");
50+
println!("CONCURRENCY={CONCURRENCY}");
51+
println!("ENDPOINT_CAPACITY={ENDPOINT_CAPACITY}");
5252
print!("MAX_ENDPOINT_LATENCIES=[");
5353
for max in &MAX_ENDPOINT_LATENCIES {
5454
let l = max.as_secs() * 1_000 + u64::from(max.subsec_millis());
55-
print!("{}ms, ", l);
55+
print!("{l}ms, ");
5656
}
5757
println!("]");
5858

@@ -149,7 +149,7 @@ where
149149
<D::Service as Service<Req>>::Future: Send,
150150
<D::Service as load::Load>::Metric: std::fmt::Debug,
151151
{
152-
println!("{}", name);
152+
println!("{name}");
153153

154154
let requests = stream::repeat(Req).take(REQUESTS);
155155
let service = ConcurrencyLimit::new(lb, CONCURRENCY);
@@ -193,7 +193,7 @@ impl Summary {
193193
}
194194
for (i, c) in self.count_by_instance.iter().enumerate() {
195195
let p = *c as f64 / total as f64 * 100.0;
196-
println!(" [{:02}] {:>5.01}%", i, p);
196+
println!(" [{i:02}] {p:>5.01}%");
197197
}
198198

199199
println!(" wall {:4}s", self.start.elapsed().as_secs());

tower/src/buffer/layer.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ where
5656
}
5757

5858
impl<Request> fmt::Debug for BufferLayer<Request> {
59-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
59+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6060
f.debug_struct("BufferLayer")
6161
.field("bound", &self.bound)
6262
.finish()
@@ -65,10 +65,7 @@ impl<Request> fmt::Debug for BufferLayer<Request> {
6565

6666
impl<Request> Clone for BufferLayer<Request> {
6767
fn clone(&self) -> Self {
68-
Self {
69-
bound: self.bound,
70-
_p: PhantomData,
71-
}
68+
*self
7269
}
7370
}
7471

tower/src/load/peak_ewma.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ mod tests {
398398
assert_eq!(super::nanos(Duration::new(0, 123)), 123.0);
399399
assert_eq!(super::nanos(Duration::new(1, 23)), 1_000_000_023.0);
400400
assert_eq!(
401-
super::nanos(Duration::new(::std::u64::MAX, 999_999_999)),
401+
super::nanos(Duration::new(u64::MAX, 999_999_999)),
402402
18446744074709553000.0
403403
);
404404
}

tower/src/retry/budget/tps_budget.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl TpsBudget {
7272
assert!(ttl <= Duration::from_secs(60));
7373
assert!(retry_percent >= 0.0);
7474
assert!(retry_percent <= 1000.0);
75-
assert!(min_per_sec < ::std::i32::MAX as u32);
75+
assert!(min_per_sec < i32::MAX as u32);
7676

7777
let (deposit_amount, withdraw_amount) = if retry_percent == 0.0 {
7878
// If there is no percent, then you gain nothing from deposits.

tower/src/util/future_service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ mod tests {
186186
let mut pending_svc = future_service(ready(Ok(DebugService)));
187187

188188
assert_eq!(
189-
format!("{:?}", pending_svc),
189+
format!("{pending_svc:?}"),
190190
"FutureService { state: State::Future(<core::future::ready::Ready<core::result::Result<tower::util::future_service::tests::DebugService, core::convert::Infallible>>>) }"
191191
);
192192

193193
pending_svc.ready().await.unwrap();
194194

195195
assert_eq!(
196-
format!("{:?}", pending_svc),
196+
format!("{pending_svc:?}"),
197197
"FutureService { state: State::Service(DebugService) }"
198198
);
199199
}

tower/src/util/oneshot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ where
8888
loop {
8989
match this.state.as_mut().project() {
9090
StateProj::NotReady { svc, req } => {
91-
let _ = ready!(svc.poll_ready(cx))?;
91+
ready!(svc.poll_ready(cx))?;
9292
let f = svc.call(req.take().expect("already called"));
9393
this.state.set(State::called(f));
9494
}

0 commit comments

Comments
 (0)