clippy: fix warnings from collapsible_if lint
This commit is contained in:
@@ -217,10 +217,12 @@ impl SysFSCpu {
|
|||||||
.map_err(|err| ChCpuError::io0("write standard output", err));
|
.map_err(|err| ChCpuError::io0("write standard output", err));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(enabled_cpu_list) = enabled_cpu_list {
|
if let Some(enabled_cpu_list) = enabled_cpu_list
|
||||||
if previous_config && !configure && enabled_cpu_list.0.contains(&cpu_index) {
|
&& previous_config
|
||||||
return Err(ChCpuError::CpuIsEnabled(cpu_index));
|
&& !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)) {
|
if let Err(err) = self.write_value(&configure_path, u8::from(configure)) {
|
||||||
|
|||||||
@@ -341,11 +341,11 @@ pub(crate) fn describe(
|
|||||||
let now = time_of_day()?;
|
let now = time_of_day()?;
|
||||||
let sys_v_ipc = SysVIpc::new(id)?;
|
let sys_v_ipc = SysVIpc::new(id)?;
|
||||||
|
|
||||||
if let Some(id) = id {
|
if let Some(id) = id
|
||||||
if sys_v_ipc.0.len() != 1 {
|
&& sys_v_ipc.0.len() != 1
|
||||||
eprintln!("id {id} not found");
|
{
|
||||||
return Ok(());
|
eprintln!("id {id} not found");
|
||||||
}
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
table.set_name(c"messages")?;
|
table.set_name(c"messages")?;
|
||||||
|
|||||||
@@ -410,11 +410,11 @@ pub(crate) fn describe(
|
|||||||
let now = time_of_day()?;
|
let now = time_of_day()?;
|
||||||
let sys_v_ipc = SysVIpc::new(id)?;
|
let sys_v_ipc = SysVIpc::new(id)?;
|
||||||
|
|
||||||
if let Some(id) = id {
|
if let Some(id) = id
|
||||||
if sys_v_ipc.0.len() != 1 {
|
&& sys_v_ipc.0.len() != 1
|
||||||
eprintln!("id {id} not found");
|
{
|
||||||
return Ok(());
|
eprintln!("id {id} not found");
|
||||||
}
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
table.set_name(c"semaphores")?;
|
table.set_name(c"semaphores")?;
|
||||||
|
|||||||
@@ -391,11 +391,11 @@ pub(crate) fn describe(
|
|||||||
let now = time_of_day()?;
|
let now = time_of_day()?;
|
||||||
let sys_v_ipc = SysVIpc::new(id)?;
|
let sys_v_ipc = SysVIpc::new(id)?;
|
||||||
|
|
||||||
if let Some(id) = id {
|
if let Some(id) = id
|
||||||
if sys_v_ipc.0.len() != 1 {
|
&& sys_v_ipc.0.len() != 1
|
||||||
eprintln!("id {id} not found");
|
{
|
||||||
return Ok(());
|
eprintln!("id {id} not found");
|
||||||
}
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
table.set_name(c"sharedmemory")?;
|
table.set_name(c"sharedmemory")?;
|
||||||
|
|||||||
@@ -275,22 +275,23 @@ impl LockInfo {
|
|||||||
|
|
||||||
let range = start..end;
|
let range = start..end;
|
||||||
|
|
||||||
if let Some(pid_locks) = pid_locks {
|
if let Some(pid_locks) = pid_locks
|
||||||
if command_name.is_none() && !blocked {
|
&& command_name.is_none()
|
||||||
let lock_compare = |lock: &&LockInfo| {
|
&& !blocked
|
||||||
lock.range == range
|
{
|
||||||
&& lock.inode == inode
|
let lock_compare = |lock: &&LockInfo| {
|
||||||
&& lock.device_id == device_id
|
lock.range == range
|
||||||
&& lock.mandatory == mandatory
|
&& lock.inode == inode
|
||||||
&& lock.blocked == blocked
|
&& lock.device_id == device_id
|
||||||
&& lock.kind == kind
|
&& lock.mandatory == mandatory
|
||||||
&& lock.mode == mode
|
&& lock.blocked == blocked
|
||||||
};
|
&& lock.kind == kind
|
||||||
|
&& lock.mode == mode
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(found) = pid_locks.iter().find(lock_compare) {
|
if let Some(found) = pid_locks.iter().find(lock_compare) {
|
||||||
process_id = found.process_id;
|
process_id = found.process_id;
|
||||||
command_name = found.command_name.clone();
|
command_name = found.command_name.clone();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user