libs: resolve manual_checked_ops warning in mem-agent for Rust 1.95

Replace manual `if us != 0` guard before integer division with
`checked_div` as flagged by the new `clippy::manual_checked_ops` lint
in Rust 1.95.

Generated-by: IBM Bob
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
stevenhorsman
2026-06-30 05:54:54 -07:00
parent d9388fe681
commit 4e68168fcf

View File

@@ -144,8 +144,8 @@ impl Period {
if self.last_psi != 0 && self.last_psi < psi && self.last_update_time < now {
let us = (now - self.last_update_time).num_milliseconds() as u64 * 1000;
if us != 0 {
percent = (psi - self.last_psi) * 100 / us;
if let Some(result) = ((psi - self.last_psi) * 100).checked_div(us) {
percent = result;
}
}