clippy: fix warnings with Rust 1.95.0

from the collapsible_match and unnecessary_sort_by lints
This commit is contained in:
Daniel Hofstetter
2026-04-16 16:12:38 +02:00
parent 0ef16701f3
commit 953e354ffd
3 changed files with 5 additions and 7 deletions
+2 -2
View File
@@ -405,9 +405,9 @@ fn process_flag_o_n(
.collect::<Vec<_>>();
if settings.newest {
filtered.sort_by(|a, b| b.pid.cmp(&a.pid));
filtered.sort_by_key(|b| std::cmp::Reverse(b.pid));
} else {
filtered.sort_by(|a, b| a.pid.cmp(&b.pid));
filtered.sort_by_key(|a| a.pid);
}
vec![filtered.first().cloned().unwrap().clone()]
+2 -4
View File
@@ -316,10 +316,8 @@ pub fn parse_smaps(contents: &str) -> Result<SmapTable, Error> {
let val = val.strip_suffix(" kB").unwrap_or(val);
let val = get_smap_item_value(val)?;
match key {
pmap_field_name::SIZE => {
if smap_entry.map_line.size_in_kb != val {
return Err(Error::from(ErrorKind::InvalidData));
}
pmap_field_name::SIZE if smap_entry.map_line.size_in_kb != val => {
return Err(Error::from(ErrorKind::InvalidData));
}
pmap_field_name::KERNEL_PAGE_SIZE => {
smap_entry.kernel_page_size_in_kb = val;
+1 -1
View File
@@ -13,5 +13,5 @@ pub(crate) fn sort(input: &mut [ProcessInformation], _matches: &ArgMatches) {
/// Sort by pid. (Default)
fn sort_by_pid(input: &mut [ProcessInformation]) {
input.sort_by(|a, b| a.pid.cmp(&b.pid));
input.sort_by_key(|a| a.pid);
}