mirror of
https://github.com/nushell/nushell.git
synced 2025-05-13 22:44:27 +02:00
Apply clippy suggestions
This commit is contained in:
parent
2590b22ae2
commit
914dba8c6f
@ -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!");
|
let mut jobs = engine_state.jobs.lock().expect("jobs lock is poisoned!");
|
||||||
|
|
||||||
match jobs.lookup_mut(id) {
|
match jobs.lookup_mut(id) {
|
||||||
None => {
|
None => Err(ShellError::JobNotFound {
|
||||||
return Err(ShellError::JobNotFound {
|
|
||||||
id: id.get(),
|
id: id.get(),
|
||||||
span: head,
|
span: head,
|
||||||
});
|
}),
|
||||||
}
|
|
||||||
|
|
||||||
Some(Job::Frozen { .. }) => {
|
Some(Job::Frozen { .. }) => Err(ShellError::UnsupportedJobType {
|
||||||
return Err(ShellError::UnsupportedJobType {
|
|
||||||
id: id.get() as usize,
|
id: id.get() as usize,
|
||||||
span: head,
|
span: head,
|
||||||
kind: "frozen".to_string(),
|
kind: "frozen".to_string(),
|
||||||
});
|
}),
|
||||||
}
|
|
||||||
|
|
||||||
Some(Job::Thread(job)) => {
|
Some(Job::Thread(job)) => {
|
||||||
let waiter = job.on_termination().clone();
|
let waiter = job.on_termination().clone();
|
||||||
@ -104,9 +100,8 @@ pub fn wait_with_interrupt<R, E>(
|
|||||||
loop {
|
loop {
|
||||||
interrupted()?;
|
interrupted()?;
|
||||||
|
|
||||||
match wait(check_interval) {
|
if let Some(result) = wait(check_interval) {
|
||||||
Some(result) => return Ok(result),
|
return Ok(result);
|
||||||
None => {} // do nothing, try again
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
sync::{Arc, Mutex, WaitTimeoutResult},
|
sync::{Arc, Mutex},
|
||||||
time::Instant,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use nu_system::{kill_by_pid, UnfreezeHandle};
|
use nu_system::{kill_by_pid, UnfreezeHandle};
|
||||||
@ -336,9 +335,9 @@ impl<T> Waiter<T> {
|
|||||||
{
|
{
|
||||||
Ok((_guard, result)) => {
|
Ok((_guard, result)) => {
|
||||||
if result.timed_out() {
|
if result.timed_out() {
|
||||||
return None;
|
None
|
||||||
} else {
|
} else {
|
||||||
return Some(inner.value.get().unwrap());
|
Some(inner.value.get().unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => panic!("mutex is poisoned!"),
|
Err(_) => panic!("mutex is poisoned!"),
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::process::Command as CommandSys;
|
use std::process::Command as CommandSys;
|
||||||
use std::time::{Duration, Instant};
|
|
||||||
|
|
||||||
/// Tries to forcefully kill a process by its PID
|
/// Tries to forcefully kill a process by its PID
|
||||||
pub fn kill_by_pid(pid: i64) -> io::Result<()> {
|
pub fn kill_by_pid(pid: i64) -> io::Result<()> {
|
||||||
|
Loading…
Reference in New Issue
Block a user