mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 04:45:04 +02:00
Fix future clippy lints (#15519)
- suggestions for tersity using helpers
This commit is contained in:
committed by
GitHub
parent
a886e30e04
commit
ecb9799b6a
@ -10,11 +10,7 @@ use nu_protocol::{
|
||||
};
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::prelude::FileTypeExt;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
io::{Error, ErrorKind},
|
||||
path::PathBuf,
|
||||
};
|
||||
use std::{collections::HashMap, io::Error, path::PathBuf};
|
||||
|
||||
const TRASH_SUPPORTED: bool = cfg!(all(
|
||||
feature = "trash-support",
|
||||
@ -379,7 +375,7 @@ fn rm(
|
||||
);
|
||||
|
||||
let result = if let Err(e) = interaction {
|
||||
Err(Error::new(ErrorKind::Other, &*e.to_string()))
|
||||
Err(Error::other(&*e.to_string()))
|
||||
} else if interactive && !confirmed {
|
||||
Ok(())
|
||||
} else if TRASH_SUPPORTED && (trash || (rm_always_trash && !permanent)) {
|
||||
@ -389,7 +385,7 @@ fn rm(
|
||||
))]
|
||||
{
|
||||
trash::delete(&f).map_err(|e: trash::Error| {
|
||||
Error::new(ErrorKind::Other, format!("{e:?}\nTry '--permanent' flag"))
|
||||
Error::other(format!("{e:?}\nTry '--permanent' flag"))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ impl<R: Read> Read for IoTee<R> {
|
||||
if let Some(thread) = self.thread.take() {
|
||||
if thread.is_finished() {
|
||||
if let Err(err) = thread.join().unwrap_or_else(|_| Err(panic_error())) {
|
||||
return Err(io::Error::new(io::ErrorKind::Other, err));
|
||||
return Err(io::Error::other(err));
|
||||
}
|
||||
} else {
|
||||
self.thread = Some(thread)
|
||||
@ -405,7 +405,7 @@ impl<R: Read> Read for IoTee<R> {
|
||||
self.sender = None;
|
||||
if let Some(thread) = self.thread.take() {
|
||||
if let Err(err) = thread.join().unwrap_or_else(|_| Err(panic_error())) {
|
||||
return Err(io::Error::new(io::ErrorKind::Other, err));
|
||||
return Err(io::Error::other(err));
|
||||
}
|
||||
}
|
||||
} else if let Some(sender) = self.sender.as_mut() {
|
||||
|
Reference in New Issue
Block a user