clippy: fix warnings from collapsible_if lint

This commit is contained in:
Daniel Hofstetter
2025-08-08 11:14:04 +02:00
parent 4366804267
commit cb25413e54
5 changed files with 37 additions and 34 deletions

View File

@@ -217,11 +217,13 @@ impl SysFSCpu {
.map_err(|err| ChCpuError::io0("write standard output", err));
}
if let Some(enabled_cpu_list) = enabled_cpu_list {
if previous_config && !configure && enabled_cpu_list.0.contains(&cpu_index) {
if let Some(enabled_cpu_list) = enabled_cpu_list
&& previous_config
&& !configure
&& enabled_cpu_list.0.contains(&cpu_index)
{
return Err(ChCpuError::CpuIsEnabled(cpu_index));
}
}
if let Err(err) = self.write_value(&configure_path, u8::from(configure)) {
let operation = if configure {

View File

@@ -341,12 +341,12 @@ pub(crate) fn describe(
let now = time_of_day()?;
let sys_v_ipc = SysVIpc::new(id)?;
if let Some(id) = id {
if sys_v_ipc.0.len() != 1 {
if let Some(id) = id
&& sys_v_ipc.0.len() != 1
{
eprintln!("id {id} not found");
return Ok(());
}
}
table.set_name(c"messages")?;

View File

@@ -410,12 +410,12 @@ pub(crate) fn describe(
let now = time_of_day()?;
let sys_v_ipc = SysVIpc::new(id)?;
if let Some(id) = id {
if sys_v_ipc.0.len() != 1 {
if let Some(id) = id
&& sys_v_ipc.0.len() != 1
{
eprintln!("id {id} not found");
return Ok(());
}
}
table.set_name(c"semaphores")?;

View File

@@ -391,12 +391,12 @@ pub(crate) fn describe(
let now = time_of_day()?;
let sys_v_ipc = SysVIpc::new(id)?;
if let Some(id) = id {
if sys_v_ipc.0.len() != 1 {
if let Some(id) = id
&& sys_v_ipc.0.len() != 1
{
eprintln!("id {id} not found");
return Ok(());
}
}
table.set_name(c"sharedmemory")?;

View File

@@ -275,8 +275,10 @@ impl LockInfo {
let range = start..end;
if let Some(pid_locks) = pid_locks {
if command_name.is_none() && !blocked {
if let Some(pid_locks) = pid_locks
&& command_name.is_none()
&& !blocked
{
let lock_compare = |lock: &&LockInfo| {
lock.range == range
&& lock.inode == inode
@@ -292,7 +294,6 @@ impl LockInfo {
command_name = found.command_name.clone();
}
}
}
if command_name.is_none() {
command_name = if unknown_command_name {