other: fix clippy warnings (#1712)

This commit is contained in:
Clement Tsang 2025-04-10 19:20:11 -04:00 committed by GitHub
parent d50285075d
commit 69a4b59573
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 11 deletions

View File

@ -176,7 +176,7 @@ impl StoredData {
{
match &device.volume_name {
Some(volume_name) => Some(volume_name.as_str()),
None => device.name.split('/').last(),
None => device.name.split('/').next_back(),
}
}
#[cfg(not(target_os = "windows"))]
@ -187,12 +187,12 @@ impl StoredData {
Some(device.name.as_str()) // use the whole zfs
// dataset name
} else {
device.name.split('/').last()
device.name.split('/').next_back()
}
}
#[cfg(not(feature = "zfs"))]
{
device.name.split('/').last()
device.name.split('/').next_back()
}
}
}) else {

View File

@ -237,7 +237,7 @@ impl Process {
let pid = pid_path
.as_path()
.components()
.last()
.next_back()
.and_then(|s| s.to_string_lossy().parse::<Pid>().ok())
.or_else(|| {
rustix::fs::readlinkat(rustix::fs::CWD, &pid_path, vec![])

View File

@ -63,13 +63,7 @@ fn convert_rgb_to_color(rgb_str: &str) -> Result<Color, String> {
let rgb = rgb_list
.iter()
.filter_map(|val| {
if let Ok(res) = (*(*val)).to_string().trim().parse::<u8>() {
Some(res)
} else {
None
}
})
.filter_map(|val| (*(*val)).to_string().trim().parse::<u8>().ok())
.collect::<Vec<_>>();
if rgb.len() == 3 {