From fcacb41a974706d92a1ec496954f69150938f9c8 Mon Sep 17 00:00:00 2001 From: Lauren Datz <105828115+ladatz@users.noreply.github.com> Date: Mon, 2 Oct 2023 10:52:37 -0400 Subject: [PATCH] Resolve new cargo clippy/ build warnings --- ess/benches/load_bench.rs | 2 +- ess/src/ess.rs | 2 +- examples/applications/lt-consumer/src/main.rs | 5 ++--- examples/applications/simple-provider/src/main.rs | 2 +- examples/common/src/chariott/provider.rs | 2 +- rust-toolchain.toml | 2 +- src/registry.rs | 4 ++-- tests/provider.rs | 2 +- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ess/benches/load_bench.rs b/ess/benches/load_bench.rs index e98feb8a..25ea68f5 100644 --- a/ess/benches/load_bench.rs +++ b/ess/benches/load_bench.rs @@ -53,7 +53,7 @@ fn event_sub_system_bench(c: &mut Criterion) { let (_, mut receiver_stream) = sut.read_events(client_id.clone()); { let sender = sender.clone(); - _ = runtime.handle().spawn(async move { + runtime.handle().spawn(async move { let mut count: usize = 0; while (receiver_stream.next().await).is_some() { count += 1; diff --git a/ess/src/ess.rs b/ess/src/ess.rs index 3903331a..b52148c2 100644 --- a/ess/src/ess.rs +++ b/ess/src/ess.rs @@ -223,7 +223,7 @@ where { let client_by_id = self.client_by_id.read().unwrap(); match client_by_id.get(client_id) { - Some(client) => client.subscriptions.iter().map(|(id, _)| id.clone()).collect(), + Some(client) => client.subscriptions.keys().cloned().collect(), None => vec![], } } diff --git a/examples/applications/lt-consumer/src/main.rs b/examples/applications/lt-consumer/src/main.rs index c90075ca..8be76354 100644 --- a/examples/applications/lt-consumer/src/main.rs +++ b/examples/applications/lt-consumer/src/main.rs @@ -56,8 +56,7 @@ async fn wain() -> Result<(), Error> { let invoke_count: u64 = env(TARGET_INVOKE_COUNT_ENV).unwrap(); let target_rate: u32 = env(TARGET_RATE_ENV).unwrap(); let collect_docker_stats = env(COLLECT_DOCKER_STATS_ENV).unwrap_or(false); - let chunk_execution_duration = - Duration::from_millis(1_000 * CHUNK_SIZE as u64 / target_rate as u64); + let chunk_execution_duration = Duration::from_millis(1_000 * CHUNK_SIZE / target_rate as u64); let chariott = GrpcChariott::connect().await?; let latency_metric = Arc::new(Mutex::new(Summary::with_defaults())); @@ -104,7 +103,7 @@ async fn wain() -> Result<(), Error> { let latency_metric = Arc::clone(&latency_metric); let invoke_fulfillments = Arc::clone(&invoke_fulfillments); - _ = tokio::task::spawn(async move { + tokio::task::spawn(async move { // Measure the latency based on the sample rate. let now = if c % SAMPLE_RATE == 0 { Some(Instant::now()) } else { None }; diff --git a/examples/applications/simple-provider/src/main.rs b/examples/applications/simple-provider/src/main.rs index dddafbdb..76041654 100644 --- a/examples/applications/simple-provider/src/main.rs +++ b/examples/applications/simple-provider/src/main.rs @@ -110,7 +110,7 @@ async fn register_and_announce_provider( ttl_seconds: u64, ) -> Result<(), Error> { // Initiate registration and announce thread. - _ = tokio::task::spawn(async move { + tokio::task::spawn(async move { let mut client = None; // Loop that handles provider registration and announce heartbeat pattern. diff --git a/examples/common/src/chariott/provider.rs b/examples/common/src/chariott/provider.rs index 8e444a74..ff71e055 100644 --- a/examples/common/src/chariott/provider.rs +++ b/examples/common/src/chariott/provider.rs @@ -75,7 +75,7 @@ pub async fn register( // Potential race condition if we register before the server is up. // Since this is only an example, we do not ensure that the race does not // happen. - _ = tokio::task::spawn(registration.register()); + tokio::task::spawn(registration.register()); Ok((announce_url, socket_address)) } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7e8f0a9a..f400973c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.72" +channel = "1.70" diff --git a/src/registry.rs b/src/registry.rs index 1801243d..0aee1738 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -166,8 +166,8 @@ impl Registry { change_series.observe(&self.observer, self); self.known_services - .iter() - .map(|(_, ts)| *ts + ttl) + .values() + .map(|ts| *ts + ttl) .min() .map(|t| (Specific, t)) .unwrap_or((Default, timestamp + ttl)) diff --git a/tests/provider.rs b/tests/provider.rs index d180ee13..802af58f 100644 --- a/tests/provider.rs +++ b/tests/provider.rs @@ -38,7 +38,7 @@ impl Provider { socket.bind(SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), port)).unwrap(); let listener = TcpListenerStream::new(socket.listen(2).unwrap()); - _ = spawn( + spawn( Server::builder() .add_service(ProviderServiceServer::new(self)) .serve_with_incoming(listener),