From 497fa7cedf999413b30aef6df0d33b23fd98836f Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 11 Jan 2025 11:47:51 +0000 Subject: [PATCH] scx_utils: addressing few clippy build warnings. --- rust/scx_stats/src/server.rs | 2 +- rust/scx_utils/src/compat.rs | 2 +- rust/scx_utils/src/cpumask.rs | 2 +- rust/scx_utils/src/misc.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust/scx_stats/src/server.rs b/rust/scx_stats/src/server.rs index 8949ce682..352efd7a9 100644 --- a/rust/scx_stats/src/server.rs +++ b/rust/scx_stats/src/server.rs @@ -436,7 +436,7 @@ where loop { let mut line = String::new(); stream_reader.read_line(&mut line)?; - if line.len() == 0 { + if line.is_empty() { return Ok(()); } if exit.load(Ordering::Relaxed) { diff --git a/rust/scx_utils/src/compat.rs b/rust/scx_utils/src/compat.rs index 4d88dca5b..dd18bae2f 100644 --- a/rust/scx_utils/src/compat.rs +++ b/rust/scx_utils/src/compat.rs @@ -124,7 +124,7 @@ pub fn struct_has_field(type_name: &str, field: &str) -> Result { } } - return Ok(false); + Ok(false) } pub fn ksym_exists(ksym: &str) -> Result { diff --git a/rust/scx_utils/src/cpumask.rs b/rust/scx_utils/src/cpumask.rs index 713625fd7..8f70cfb5a 100644 --- a/rust/scx_utils/src/cpumask.rs +++ b/rust/scx_utils/src/cpumask.rs @@ -305,7 +305,7 @@ pub struct CpumaskIterator<'a> { index: usize, } -impl<'a> Iterator for CpumaskIterator<'a> { +impl Iterator for CpumaskIterator<'_> { type Item = usize; fn next(&mut self) -> Option { diff --git a/rust/scx_utils/src/misc.rs b/rust/scx_utils/src/misc.rs index 0d173a2de..54754ec3e 100644 --- a/rust/scx_utils/src/misc.rs +++ b/rust/scx_utils/src/misc.rs @@ -9,7 +9,7 @@ use std::thread::sleep; use std::time::Duration; pub fn monitor_stats( - stats_args: &Vec<(String, String)>, + stats_args: &[(String, String)], intv: Duration, mut should_exit: impl FnMut() -> bool, mut output: impl FnMut(T) -> Result<()>, @@ -42,7 +42,7 @@ where retry_cnt = 0; while !should_exit() { - let stats = match client.request::("stats", stats_args.clone()) { + let stats = match client.request::("stats", stats_args.to_owned()) { Ok(v) => v, Err(e) => match e.downcast_ref::() { Some(ioe) => {