Apply clippy suggestions

This commit is contained in:
Renan Ribeiro 2025-04-25 21:13:43 -03:00
parent 2590b22ae2
commit 914dba8c6f
3 changed files with 14 additions and 21 deletions

View File

@ -55,20 +55,16 @@ Note that this command fails if the provided job id is currently not in the job
let mut jobs = engine_state.jobs.lock().expect("jobs lock is poisoned!");
match jobs.lookup_mut(id) {
None => {
return Err(ShellError::JobNotFound {
id: id.get(),
span: head,
});
}
None => Err(ShellError::JobNotFound {
id: id.get(),
span: head,
}),
Some(Job::Frozen { .. }) => {
return Err(ShellError::UnsupportedJobType {
id: id.get() as usize,
span: head,
kind: "frozen".to_string(),
});
}
Some(Job::Frozen { .. }) => Err(ShellError::UnsupportedJobType {
id: id.get() as usize,
span: head,
kind: "frozen".to_string(),
}),
Some(Job::Thread(job)) => {
let waiter = job.on_termination().clone();
@ -104,9 +100,8 @@ pub fn wait_with_interrupt<R, E>(
loop {
interrupted()?;
match wait(check_interval) {
Some(result) => return Ok(result),
None => {} // do nothing, try again
if let Some(result) = wait(check_interval) {
return Ok(result);
}
}
}

View File

@ -1,7 +1,6 @@
use std::{
collections::{HashMap, HashSet},
sync::{Arc, Mutex, WaitTimeoutResult},
time::Instant,
sync::{Arc, Mutex},
};
use nu_system::{kill_by_pid, UnfreezeHandle};
@ -336,9 +335,9 @@ impl<T> Waiter<T> {
{
Ok((_guard, result)) => {
if result.timed_out() {
return None;
None
} else {
return Some(inner.value.get().unwrap());
Some(inner.value.get().unwrap())
}
}
Err(_) => panic!("mutex is poisoned!"),

View File

@ -1,6 +1,5 @@
use std::io;
use std::process::Command as CommandSys;
use std::time::{Duration, Instant};
/// Tries to forcefully kill a process by its PID
pub fn kill_by_pid(pid: i64) -> io::Result<()> {