mirror of
https://github.com/uutils/procps.git
synced 2026-05-06 06:06:43 -04:00
clippy: fix warnings with Rust 1.95.0
from the collapsible_match and unnecessary_sort_by lints
This commit is contained in:
@@ -405,9 +405,9 @@ fn process_flag_o_n(
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
if settings.newest {
|
if settings.newest {
|
||||||
filtered.sort_by(|a, b| b.pid.cmp(&a.pid));
|
filtered.sort_by_key(|b| std::cmp::Reverse(b.pid));
|
||||||
} else {
|
} else {
|
||||||
filtered.sort_by(|a, b| a.pid.cmp(&b.pid));
|
filtered.sort_by_key(|a| a.pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec![filtered.first().cloned().unwrap().clone()]
|
vec![filtered.first().cloned().unwrap().clone()]
|
||||||
|
|||||||
@@ -316,10 +316,8 @@ pub fn parse_smaps(contents: &str) -> Result<SmapTable, Error> {
|
|||||||
let val = val.strip_suffix(" kB").unwrap_or(val);
|
let val = val.strip_suffix(" kB").unwrap_or(val);
|
||||||
let val = get_smap_item_value(val)?;
|
let val = get_smap_item_value(val)?;
|
||||||
match key {
|
match key {
|
||||||
pmap_field_name::SIZE => {
|
pmap_field_name::SIZE if smap_entry.map_line.size_in_kb != val => {
|
||||||
if smap_entry.map_line.size_in_kb != val {
|
return Err(Error::from(ErrorKind::InvalidData));
|
||||||
return Err(Error::from(ErrorKind::InvalidData));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pmap_field_name::KERNEL_PAGE_SIZE => {
|
pmap_field_name::KERNEL_PAGE_SIZE => {
|
||||||
smap_entry.kernel_page_size_in_kb = val;
|
smap_entry.kernel_page_size_in_kb = val;
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ pub(crate) fn sort(input: &mut [ProcessInformation], _matches: &ArgMatches) {
|
|||||||
|
|
||||||
/// Sort by pid. (Default)
|
/// Sort by pid. (Default)
|
||||||
fn sort_by_pid(input: &mut [ProcessInformation]) {
|
fn sort_by_pid(input: &mut [ProcessInformation]) {
|
||||||
input.sort_by(|a, b| a.pid.cmp(&b.pid));
|
input.sort_by_key(|a| a.pid);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user