Fix latest clippy warnings (#3049)

This commit is contained in:
Jonathan Turner
2021-02-12 23:13:14 +13:00
committed by GitHub
parent 041086d22a
commit 5481db4079
213 changed files with 334 additions and 375 deletions

View File

@ -707,7 +707,7 @@ impl Shell for FilesystemShell {
fn open(
&self,
path: &PathBuf,
path: &Path,
name: Span,
with_encoding: Option<&'static Encoding>,
) -> Result<BoxStream<'static, Result<StringOrBinary, ShellError>>, ShellError> {
@ -764,7 +764,7 @@ impl Shell for FilesystemShell {
fn save(
&mut self,
full_path: &PathBuf,
full_path: &Path,
save_data: &[u8],
name: Span,
) -> Result<OutputStream, ShellError> {
@ -1091,7 +1091,7 @@ pub(crate) fn dir_entry_dict(
Ok(dict.into_value())
}
fn path_contains_hidden_folder(path: &PathBuf, folders: &[PathBuf]) -> bool {
fn path_contains_hidden_folder(path: &Path, folders: &[PathBuf]) -> bool {
let path_str = path.to_str().expect("failed to read path");
if folders
.iter()

View File

@ -163,7 +163,6 @@ pub fn scan(
None
}
}).map(|p| p.build())
.filter_map(Result::ok)
.collect::<Vec<crate::whole_stream_command::Command>>();
plugins.extend(plugs);
}

View File

@ -31,10 +31,10 @@ enum PluginCommand {
}
impl PluginCommand {
fn command(self) -> Result<crate::whole_stream_command::Command, ShellError> {
fn command(self) -> crate::whole_stream_command::Command {
match self {
PluginCommand::Filter(cmd) => Ok(whole_stream_command(cmd)),
PluginCommand::Sink(cmd) => Ok(whole_stream_command(cmd)),
PluginCommand::Filter(cmd) => whole_stream_command(cmd),
PluginCommand::Sink(cmd) => whole_stream_command(cmd),
}
}
}
@ -71,7 +71,7 @@ impl PluginCommandBuilder {
}
}
pub fn build(&self) -> Result<crate::whole_stream_command::Command, ShellError> {
pub fn build(&self) -> crate::whole_stream_command::Command {
let mode = &self.mode;
let name = self.name.clone();

View File

@ -17,7 +17,7 @@ use nu_stream::OutputStream;
use nu_value_ext::ValueExt;
use std::collections::VecDeque;
use std::ffi::OsStr;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
@ -225,7 +225,7 @@ impl Shell for HelpShell {
fn open(
&self,
_path: &PathBuf,
_path: &Path,
_name: Span,
_with_encoding: Option<&'static Encoding>,
) -> Result<BoxStream<'static, Result<StringOrBinary, ShellError>>, ShellError> {
@ -236,7 +236,7 @@ impl Shell for HelpShell {
fn save(
&mut self,
_path: &PathBuf,
_path: &Path,
_contents: &[u8],
_name: Span,
) -> Result<OutputStream, ShellError> {

View File

@ -7,7 +7,7 @@ use encoding_rs::Encoding;
use futures::stream::BoxStream;
use nu_errors::ShellError;
use nu_source::{Span, Tag};
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
@ -38,13 +38,13 @@ pub trait Shell: std::fmt::Debug {
fn set_path(&mut self, path: String);
fn open(
&self,
path: &PathBuf,
path: &Path,
name: Span,
with_encoding: Option<&'static Encoding>,
) -> Result<BoxStream<'static, Result<StringOrBinary, ShellError>>, ShellError>;
fn save(
&mut self,
path: &PathBuf,
path: &Path,
contents: &[u8],
name: Span,
) -> Result<OutputStream, ShellError>;

View File

@ -9,7 +9,7 @@ use encoding_rs::Encoding;
use nu_errors::ShellError;
use nu_source::{Span, Tag};
use parking_lot::Mutex;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::Arc;
@ -71,7 +71,7 @@ impl ShellManager {
pub fn open(
&self,
full_path: &PathBuf,
full_path: &Path,
name: Span,
with_encoding: Option<&'static Encoding>,
) -> Result<impl Stream<Item = Result<StringOrBinary, ShellError>> + Send + 'static, ShellError>
@ -81,7 +81,7 @@ impl ShellManager {
pub fn save(
&self,
full_path: &PathBuf,
full_path: &Path,
save_data: &[u8],
name: Span,
) -> Result<OutputStream, ShellError> {

View File

@ -235,7 +235,7 @@ impl Shell for ValueShell {
fn open(
&self,
_path: &PathBuf,
_path: &Path,
_name: Span,
_with_encoding: Option<&'static Encoding>,
) -> Result<BoxStream<'static, Result<StringOrBinary, ShellError>>, ShellError> {
@ -246,7 +246,7 @@ impl Shell for ValueShell {
fn save(
&mut self,
_path: &PathBuf,
_path: &Path,
_contents: &[u8],
_name: Span,
) -> Result<OutputStream, ShellError> {