Skip to content

Commit 53254bb

Browse files
mivertowskiclaude
andcommitted
Fix remaining clippy warnings in ringkernel-core
- Use checked_div() instead of manual division check in multi_gpu.rs - Use sort_by_key() with Reverse instead of sort_by() in observability.rs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 619a047 commit 53254bb

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

crates/ringkernel-core/src/multi_gpu.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,16 +1685,14 @@ impl KernelMigrator {
16851685
successful_migrations: successful,
16861686
failed_migrations: failed,
16871687
bytes_transferred: self.stats.bytes_transferred.load(Ordering::Relaxed),
1688-
avg_checkpoint_time: if total > 0 {
1689-
Duration::from_micros(checkpoint_us / total)
1690-
} else {
1691-
Duration::ZERO
1692-
},
1693-
avg_restore_time: if total > 0 {
1694-
Duration::from_micros(restore_us / total)
1695-
} else {
1696-
Duration::ZERO
1697-
},
1688+
avg_checkpoint_time: checkpoint_us
1689+
.checked_div(total)
1690+
.map(Duration::from_micros)
1691+
.unwrap_or(Duration::ZERO),
1692+
avg_restore_time: restore_us
1693+
.checked_div(total)
1694+
.map(Duration::from_micros)
1695+
.unwrap_or(Duration::ZERO),
16981696
}
16991697
}
17001698
}

crates/ringkernel-core/src/observability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2129,7 +2129,7 @@ impl GpuMemoryDashboard {
21292129
// Top allocations by size
21302130
let allocations = self.allocations.read();
21312131
let mut sorted_allocs: Vec<_> = allocations.values().collect();
2132-
sorted_allocs.sort_by(|a, b| b.size.cmp(&a.size));
2132+
sorted_allocs.sort_by_key(|a| std::cmp::Reverse(a.size));
21332133

21342134
if !sorted_allocs.is_empty() {
21352135
writeln!(report).unwrap();

0 commit comments

Comments
 (0)