From bfd7a50496bb145e7262bb8ac31bea63439bec30 Mon Sep 17 00:00:00 2001 From: Ada Bohm Date: Wed, 22 Apr 2026 10:04:14 +0200 Subject: [PATCH] Rust 1.95.0 clippy updates --- crates/hyperqueue/src/client/output/cli.rs | 2 +- .../dashboard/ui/screens/cluster/worker/cpu_util_table.rs | 8 ++------ crates/tako/src/internal/worker/resources/allocator.rs | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/hyperqueue/src/client/output/cli.rs b/crates/hyperqueue/src/client/output/cli.rs index 29aaa99fa..47ff47f71 100644 --- a/crates/hyperqueue/src/client/output/cli.rs +++ b/crates/hyperqueue/src/client/output/cli.rs @@ -962,7 +962,7 @@ impl Output for CliOutput { fn print_autoalloc_queues(&self, info: AutoAllocListQueuesResponse) { let mut queues: Vec<_> = info.queues.into_iter().collect(); - queues.sort_unstable_by(|a, b| a.0.cmp(&b.0)); + queues.sort_unstable_by_key(|a| a.0); let rows: Vec<_> = queues .into_iter() diff --git a/crates/hyperqueue/src/dashboard/ui/screens/cluster/worker/cpu_util_table.rs b/crates/hyperqueue/src/dashboard/ui/screens/cluster/worker/cpu_util_table.rs index 612163903..492fc5e43 100644 --- a/crates/hyperqueue/src/dashboard/ui/screens/cluster/worker/cpu_util_table.rs +++ b/crates/hyperqueue/src/dashboard/ui/screens/cluster/worker/cpu_util_table.rs @@ -330,12 +330,8 @@ fn get_column_constraints(rect: Rect, num_cpus: usize) -> Vec { let max_columns = (rect.width / CPU_METER_WIDTH as u16) as usize; let num_columns = cmp::min(max_columns, num_cpus); - if num_columns > 0 { - std::iter::repeat_n( - Constraint::Percentage((100 / num_columns) as u16), - num_columns, - ) - .collect() + if let Some(p) = 100usize.checked_div(num_columns) { + std::iter::repeat_n(Constraint::Percentage(p as u16), num_columns).collect() } else { vec![] } diff --git a/crates/tako/src/internal/worker/resources/allocator.rs b/crates/tako/src/internal/worker/resources/allocator.rs index 58692bf31..02e5b925b 100644 --- a/crates/tako/src/internal/worker/resources/allocator.rs +++ b/crates/tako/src/internal/worker/resources/allocator.rs @@ -190,7 +190,7 @@ impl ResourceAllocator { &self.static_info.coupling_weights, ) .unwrap(); - for (entry, group_set) in coupling.into_iter().zip(groups.into_iter()) { + for (entry, group_set) in coupling.into_iter().zip(groups) { allocation.add_resource_allocation( self.pools[entry.resource_id].claim_resources_with_group_mask( entry.resource_id,