Skip to content

Commit c794e4d

Browse files
authored
Merge pull request #354 from cakebaker/clippy_fix_warnings_rust_1_89
clippy: fix warnings introduced with Rust `1.89`
2 parents f10f452 + cb25413 commit c794e4d

6 files changed

Lines changed: 42 additions & 36 deletions

File tree

src/uu/chcpu/src/sysfs.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,12 @@ impl SysFSCpu {
217217
.map_err(|err| ChCpuError::io0("write standard output", err));
218218
}
219219

220-
if let Some(enabled_cpu_list) = enabled_cpu_list {
221-
if previous_config && !configure && enabled_cpu_list.0.contains(&cpu_index) {
222-
return Err(ChCpuError::CpuIsEnabled(cpu_index));
223-
}
220+
if let Some(enabled_cpu_list) = enabled_cpu_list
221+
&& previous_config
222+
&& !configure
223+
&& enabled_cpu_list.0.contains(&cpu_index)
224+
{
225+
return Err(ChCpuError::CpuIsEnabled(cpu_index));
224226
}
225227

226228
if let Err(err) = self.write_value(&configure_path, u8::from(configure)) {

src/uu/lsipc/src/display.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ pub(crate) fn describe_size(size: u64, in_bytes: bool) -> Option<Cow<'static, CS
246246
Some(Cow::Owned(CString::new(size_desc(size, in_bytes)).unwrap()))
247247
}
248248

249-
pub(crate) fn describe_owner(users: &mut UserDbRecordRef, uid: libc::uid_t) -> Option<Cow<CStr>> {
249+
pub(crate) fn describe_owner(
250+
users: &mut UserDbRecordRef,
251+
uid: libc::uid_t,
252+
) -> Option<Cow<'_, CStr>> {
250253
if let Some(name) = users.for_id(uid).name() {
251254
Some(Cow::Borrowed(name))
252255
} else {

src/uu/lsipc/src/message_queue.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ pub(crate) fn describe(
341341
let now = time_of_day()?;
342342
let sys_v_ipc = SysVIpc::new(id)?;
343343

344-
if let Some(id) = id {
345-
if sys_v_ipc.0.len() != 1 {
346-
eprintln!("id {id} not found");
347-
return Ok(());
348-
}
344+
if let Some(id) = id
345+
&& sys_v_ipc.0.len() != 1
346+
{
347+
eprintln!("id {id} not found");
348+
return Ok(());
349349
}
350350

351351
table.set_name(c"messages")?;

src/uu/lsipc/src/semaphore.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,11 @@ pub(crate) fn describe(
410410
let now = time_of_day()?;
411411
let sys_v_ipc = SysVIpc::new(id)?;
412412

413-
if let Some(id) = id {
414-
if sys_v_ipc.0.len() != 1 {
415-
eprintln!("id {id} not found");
416-
return Ok(());
417-
}
413+
if let Some(id) = id
414+
&& sys_v_ipc.0.len() != 1
415+
{
416+
eprintln!("id {id} not found");
417+
return Ok(());
418418
}
419419

420420
table.set_name(c"semaphores")?;

src/uu/lsipc/src/shared_memory.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,11 @@ pub(crate) fn describe(
391391
let now = time_of_day()?;
392392
let sys_v_ipc = SysVIpc::new(id)?;
393393

394-
if let Some(id) = id {
395-
if sys_v_ipc.0.len() != 1 {
396-
eprintln!("id {id} not found");
397-
return Ok(());
398-
}
394+
if let Some(id) = id
395+
&& sys_v_ipc.0.len() != 1
396+
{
397+
eprintln!("id {id} not found");
398+
return Ok(());
399399
}
400400

401401
table.set_name(c"sharedmemory")?;

src/uu/lslocks/src/utils.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -275,22 +275,23 @@ impl LockInfo {
275275

276276
let range = start..end;
277277

278-
if let Some(pid_locks) = pid_locks {
279-
if command_name.is_none() && !blocked {
280-
let lock_compare = |lock: &&LockInfo| {
281-
lock.range == range
282-
&& lock.inode == inode
283-
&& lock.device_id == device_id
284-
&& lock.mandatory == mandatory
285-
&& lock.blocked == blocked
286-
&& lock.kind == kind
287-
&& lock.mode == mode
288-
};
289-
290-
if let Some(found) = pid_locks.iter().find(lock_compare) {
291-
process_id = found.process_id;
292-
command_name = found.command_name.clone();
293-
}
278+
if let Some(pid_locks) = pid_locks
279+
&& command_name.is_none()
280+
&& !blocked
281+
{
282+
let lock_compare = |lock: &&LockInfo| {
283+
lock.range == range
284+
&& lock.inode == inode
285+
&& lock.device_id == device_id
286+
&& lock.mandatory == mandatory
287+
&& lock.blocked == blocked
288+
&& lock.kind == kind
289+
&& lock.mode == mode
290+
};
291+
292+
if let Some(found) = pid_locks.iter().find(lock_compare) {
293+
process_id = found.process_id;
294+
command_name = found.command_name.clone();
294295
}
295296
}
296297

0 commit comments

Comments
 (0)