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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
213 changed files with 334 additions and 375 deletions

View File

@ -151,6 +151,7 @@ xpath = ["nu_plugin_xpath"]
codegen-units = 1 #Reduce parallel codegen units
lto = true #Link Time Optimization
opt-level = 'z' #Optimize for size
debug = true
# Core plugins that ship with `cargo install nu` by default
# Currently, Cargo limits us to installing only one binary

View File

@ -48,11 +48,10 @@ pub fn search_paths() -> Vec<std::path::PathBuf> {
}
if let Ok(config) = nu_data::config::config(Tag::unknown()) {
if let Some(plugin_dirs) = config.get("plugin_dirs") {
if let Value {
if let Some(Value {
value: UntaggedValue::Table(pipelines),
..
} = plugin_dirs
}) = config.get("plugin_dirs")
{
for pipeline in pipelines {
if let Ok(plugin_dir) = pipeline.as_string() {
@ -61,7 +60,6 @@ pub fn search_paths() -> Vec<std::path::PathBuf> {
}
}
}
}
search_paths
}

View File

@ -51,7 +51,7 @@ impl DirectorySpecificEnvironment {
}
}
fn toml_if_trusted(&mut self, nu_env_file: &PathBuf) -> Result<NuEnvDoc, ShellError> {
fn toml_if_trusted(&mut self, nu_env_file: &Path) -> Result<NuEnvDoc, ShellError> {
let content = std::fs::read(&nu_env_file)?;
if autoenv::file_is_trusted(&nu_env_file, &content)? {
@ -161,7 +161,7 @@ impl DirectorySpecificEnvironment {
pub fn maybe_add_key(
&mut self,
seen_vars: &mut IndexSet<EnvKey>,
dir: &PathBuf,
dir: &Path,
key: &str,
val: &str,
) {
@ -169,7 +169,7 @@ impl DirectorySpecificEnvironment {
if !seen_vars.contains(key) {
seen_vars.insert(key.to_string());
self.added_vars
.entry(dir.clone())
.entry(PathBuf::from(dir))
.or_insert(IndexMap::new())
.insert(key.to_string(), var_os(key));

View File

@ -58,6 +58,7 @@ pub(crate) use nu_value_ext::ValueExt;
#[allow(unused_imports)]
pub(crate) use std::sync::atomic::Ordering;
#[allow(clippy::clippy::wrong_self_convention)]
pub trait FromInputStream {
fn from_input_stream(self) -> OutputStream;
}
@ -73,6 +74,7 @@ where
}
}
#[allow(clippy::clippy::wrong_self_convention)]
pub trait ToOutputStream {
fn to_output_stream(self) -> OutputStream;
}

View File

@ -211,7 +211,7 @@ fn get_result_shape_of(
l_shape: SyntaxShape,
op_expr: &SpannedExpression,
r_shape: SyntaxShape,
) -> Result<SyntaxShape, ShellError> {
) -> SyntaxShape {
let op = match op_expr.expr {
Expression::Literal(Literal::Operator(op)) => op,
_ => unreachable!("Passing anything but the op expr is invalid"),
@ -220,7 +220,7 @@ fn get_result_shape_of(
//There is some code for that in the evaluator already.
//One might reuse it.
//For now we ignore this issue
Ok(match op {
match op {
Operator::Equal
| Operator::NotEqual
| Operator::LessThan
@ -258,7 +258,7 @@ fn get_result_shape_of(
}
Operator::Modulo => SyntaxShape::Number,
Operator::Pow => SyntaxShape::Number,
})
}
}
fn get_shape_of_expr(expr: &SpannedExpression) -> Option<SyntaxShape> {
@ -334,7 +334,7 @@ fn get_result_shape_of_math_expr(
//match lhs, rhs
match (shapes[0], shapes[1]) {
(None, None) | (None, _) | (_, None) => Ok(None),
(Some(left), Some(right)) => get_result_shape_of(left, &bin.op, right).map(Some),
(Some(left), Some(right)) => Ok(Some(get_result_shape_of(left, &bin.op, right))),
}
}

View File

@ -286,6 +286,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Ansi {})?)
test_examples(Ansi {})
}
}

View File

@ -6,7 +6,7 @@ use serde::Deserialize;
use serde::Serialize;
use sha2::{Digest, Sha256};
use std::io::Read;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
pub struct Autoenv;
#[derive(Deserialize, Serialize, Debug, Default)]
@ -20,7 +20,7 @@ impl Trusted {
}
}
}
pub fn file_is_trusted(nu_env_file: &PathBuf, content: &[u8]) -> Result<bool, ShellError> {
pub fn file_is_trusted(nu_env_file: &Path, content: &[u8]) -> Result<bool, ShellError> {
let contentdigest = Sha256::digest(&content).as_slice().to_vec();
let nufile = std::fs::canonicalize(nu_env_file)?;

View File

@ -316,6 +316,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Command {})?)
test_examples(Command {})
}
}

View File

@ -337,6 +337,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Cal {})?)
test_examples(Cal {})
}
}

View File

@ -67,6 +67,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Cd {})?)
test_examples(Cd {})
}
}

View File

@ -143,6 +143,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Char {})?)
test_examples(Char {})
}
}

View File

@ -42,6 +42,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Chart {})?)
test_examples(Chart {})
}
}

View File

@ -101,6 +101,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Clip {})?)
test_examples(Clip {})
}
}

View File

@ -81,6 +81,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Compact {})?)
test_examples(Compact {})
}
}

View File

@ -81,6 +81,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Count {})?)
test_examples(Count {})
}
}

View File

@ -58,6 +58,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Cpy {})?)
test_examples(Cpy {})
}
}

View File

@ -35,6 +35,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Command {})?)
test_examples(Command {})
}
}

View File

@ -104,6 +104,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Date {})?)
test_examples(Date {})
}
}

View File

@ -70,6 +70,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Date {})?)
test_examples(Date {})
}
}

View File

@ -45,6 +45,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Date {})?)
test_examples(Date {})
}
}

View File

@ -100,6 +100,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Date {})?)
test_examples(Date {})
}
}

View File

@ -105,6 +105,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Date {})?)
test_examples(Date {})
}
}

View File

@ -50,6 +50,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Date {})?)
test_examples(Date {})
}
}

View File

@ -53,6 +53,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Debug {})?)
test_examples(Debug {})
}
}

View File

@ -80,6 +80,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Default {})?)
test_examples(Default {})
}
}

View File

@ -49,6 +49,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Describe {})?)
test_examples(Describe {})
}
}

View File

@ -113,6 +113,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Do {})?)
test_examples(Do {})
}
}

View File

@ -86,6 +86,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Drop {})?)
test_examples(Drop {})
}
}

View File

@ -168,6 +168,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Du {})?)
test_examples(Du {})
}
}

View File

@ -160,6 +160,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Each {})?)
test_examples(Each {})
}
}

View File

@ -111,6 +111,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(EachGroup {})?)
test_examples(EachGroup {})
}
}

View File

@ -100,6 +100,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(EachWindow {})?)
test_examples(EachWindow {})
}
}

View File

@ -200,6 +200,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Echo {})?)
test_examples(Echo {})
}
}

View File

@ -189,6 +189,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Enter {})?)
test_examples(Enter {})
}
}

View File

@ -93,6 +93,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Every {})?)
test_examples(Every {})
}
}

View File

@ -59,6 +59,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Exit {})?)
test_examples(Exit {})
}
}

View File

@ -72,6 +72,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(First {})?)
test_examples(First {})
}
}

View File

@ -57,9 +57,7 @@ async fn flatten(args: CommandArgs) -> Result<OutputStream, ShellError> {
let (Arguments { rest: columns }, input) = args.process().await?;
Ok(input
.map(move |item| {
futures::stream::iter(flat_value(&columns, &item, &tag).into_iter().flatten())
})
.map(move |item| futures::stream::iter(flat_value(&columns, &item, &tag).into_iter()))
.flatten()
.to_output_stream())
}
@ -72,7 +70,7 @@ fn flat_value(
columns: &[Tagged<String>],
item: &Value,
name_tag: impl Into<Tag>,
) -> Result<Vec<Result<ReturnSuccess, ShellError>>, ShellError> {
) -> Vec<Result<ReturnSuccess, ShellError>> {
let tag = item.tag.clone();
let name_tag = name_tag.into();
@ -121,7 +119,7 @@ fn flat_value(
name_tag.span
};
return Ok(vec![ReturnSuccess::value(
return vec![ReturnSuccess::value(
UntaggedValue::Error(ShellError::labeled_error_with_secondary(
"can only flatten one inner table at the same time",
"tried flattening more than one column with inner tables",
@ -130,7 +128,7 @@ fn flat_value(
already_flattened,
))
.into_value(name_tag),
)]);
)];
}
if !columns.is_empty() {
@ -179,5 +177,5 @@ fn flat_value(
}
};
Ok(res.into_iter().map(ReturnSuccess::value).collect())
res.into_iter().map(ReturnSuccess::value).collect()
}

View File

@ -145,6 +145,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Format {})?)
test_examples(Format {})
}
}

View File

@ -121,6 +121,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FileSize {})?)
test_examples(FileSize {})
}
}

View File

@ -35,6 +35,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(From {})?)
test_examples(From {})
}
}

View File

@ -107,6 +107,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromCSV {})?)
test_examples(FromCSV {})
}
}

View File

@ -128,6 +128,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromEML {})?)
test_examples(FromEML {})
}
}

View File

@ -247,6 +247,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromIcs {})?)
test_examples(FromIcs {})
}
}

View File

@ -93,6 +93,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromINI {})?)
test_examples(FromINI {})
}
}

View File

@ -142,6 +142,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromJSON {})?)
test_examples(FromJSON {})
}
}

View File

@ -100,6 +100,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromODS {})?)
test_examples(FromODS {})
}
}

View File

@ -227,7 +227,7 @@ fn from_ssv_string_to_value(
aligned_columns: bool,
split_at: usize,
tag: impl Into<Tag>,
) -> Option<Value> {
) -> Value {
let tag = tag.into();
let rows = string_to_table(s, headerless, aligned_columns, split_at)
.iter()
@ -244,7 +244,7 @@ fn from_ssv_string_to_value(
})
.collect();
Some(UntaggedValue::Table(rows).into_value(&tag))
UntaggedValue::Table(rows).into_value(&tag)
}
async fn from_ssv(args: CommandArgs) -> Result<OutputStream, ShellError> {
@ -271,23 +271,13 @@ async fn from_ssv(args: CommandArgs) -> Result<OutputStream, ShellError> {
split_at,
name.clone(),
) {
Some(x) => match x {
Value {
value: UntaggedValue::Table(list),
..
} => futures::stream::iter(list.into_iter().map(ReturnSuccess::value))
.to_output_stream(),
x => OutputStream::one(ReturnSuccess::value(x)),
},
None => {
return Err(ShellError::labeled_error_with_secondary(
"Could not parse as SSV",
"input cannot be parsed ssv",
&name,
"value originates from here",
&concat_string.tag,
));
} => {
futures::stream::iter(list.into_iter().map(ReturnSuccess::value)).to_output_stream()
}
x => OutputStream::one(ReturnSuccess::value(x)),
},
)
}
@ -502,6 +492,6 @@ mod tests {
use super::FromSSV;
use crate::examples::test as test_examples;
Ok(test_examples(FromSSV {})?)
test_examples(FromSSV {})
}
}

View File

@ -99,6 +99,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromTOML {})?)
test_examples(FromTOML {})
}
}

View File

@ -50,6 +50,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromTSV {})?)
test_examples(FromTSV {})
}
}

View File

@ -62,6 +62,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromURL {})?)
test_examples(FromURL {})
}
}

View File

@ -102,6 +102,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromVcf {})?)
test_examples(FromVcf {})
}
}

View File

@ -100,6 +100,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromXLSX {})?)
test_examples(FromXLSX {})
}
}

View File

@ -301,6 +301,6 @@ mod tests {
use super::FromXML;
use crate::examples::test as test_examples;
Ok(test_examples(FromXML {})?)
test_examples(FromXML {})
}
}

View File

@ -130,7 +130,7 @@ pub fn from_yaml_string_to_value(s: String, tag: impl Into<Tag>) -> Result<Value
&tag,
)
})?;
Ok(convert_yaml_value_to_nu_value(&v, tag)?)
convert_yaml_value_to_nu_value(&v, tag)
}
async fn from_yaml(args: CommandArgs) -> Result<OutputStream, ShellError> {
@ -169,7 +169,7 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(FromYAML {})?)
test_examples(FromYAML {})
}
#[test]

View File

@ -139,6 +139,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(GroupByDate {})?)
test_examples(GroupByDate {})
}
}

View File

@ -38,6 +38,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Command {})?)
test_examples(Command {})
}
}

View File

@ -114,6 +114,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Headers {})?)
test_examples(Headers {})
}
}

View File

@ -217,6 +217,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Help {})?)
test_examples(Help {})
}
}

View File

@ -225,6 +225,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Histogram {})?)
test_examples(Histogram {})
}
}

View File

@ -77,6 +77,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(History {})?)
test_examples(History {})
}
}

View File

@ -137,6 +137,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(If {})?)
test_examples(If {})
}
}

View File

@ -83,6 +83,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(IntoInt {})?)
test_examples(IntoInt {})
}
}

View File

@ -74,6 +74,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Command {})?)
test_examples(Command {})
}
}

View File

@ -109,6 +109,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -108,6 +108,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -120,6 +120,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Kill {})?)
test_examples(Kill {})
}
}

View File

@ -83,6 +83,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Last {})?)
test_examples(Last {})
}
}

View File

@ -124,6 +124,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Lines {})?)
test_examples(Lines {})
}
}

View File

@ -78,6 +78,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Ls {})?)
test_examples(Ls {})
}
}

View File

@ -64,6 +64,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -187,6 +187,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -81,6 +81,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -41,7 +41,7 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Command {})?)
test_examples(Command {})
}
#[test]

View File

@ -113,6 +113,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -81,6 +81,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -60,6 +60,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -189,6 +189,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -60,6 +60,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -85,6 +85,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -111,6 +111,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -99,6 +99,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -144,6 +144,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -125,6 +125,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -243,6 +243,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -103,6 +103,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Merge {})?)
test_examples(Merge {})
}
}

View File

@ -53,6 +53,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Mkdir {})?)
test_examples(Mkdir {})
}
}

View File

@ -71,6 +71,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Mv {})?)
test_examples(Mv {})
}
}

View File

@ -20,12 +20,12 @@ impl WholeStreamCommand for Next {
}
async fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
next(args)
Ok(next(args))
}
}
fn next(_args: CommandArgs) -> Result<OutputStream, ShellError> {
Ok(vec![Ok(ReturnSuccess::Action(CommandAction::NextShell))].into())
fn next(_args: CommandArgs) -> OutputStream {
vec![Ok(ReturnSuccess::Action(CommandAction::NextShell))].into()
}
#[cfg(test)]
@ -37,6 +37,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Next {})?)
test_examples(Next {})
}
}

View File

@ -96,6 +96,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Nth {})?)
test_examples(Nth {})
}
}

View File

@ -115,6 +115,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(SubCommand {})?)
test_examples(SubCommand {})
}
}

View File

@ -8,7 +8,7 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{CommandAction, ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value};
use nu_source::{AnchorLocation, Span, Tagged};
use std::path::PathBuf;
use std::path::{Path, PathBuf};
pub struct Open;
@ -180,13 +180,13 @@ async fn open(args: CommandArgs) -> Result<OutputStream, ShellError> {
// Note that we do not output a Stream in "fetch" since it is only used by "enter" command
// Which we expect to use a concrete Value a not a Stream
pub async fn fetch(
cwd: &PathBuf,
location: &PathBuf,
cwd: &Path,
location: &Path,
span: Span,
encoding_choice: Option<Tagged<String>>,
) -> Result<(Option<String>, Value), ShellError> {
// TODO: I don't understand the point of this? Maybe for better error reporting
let mut cwd = cwd.clone();
let mut cwd = PathBuf::from(cwd);
cwd.push(location);
let nice_location = dunce::canonicalize(&cwd).map_err(|e| match e.kind() {
std::io::ErrorKind::NotFound => ShellError::labeled_error(
@ -254,6 +254,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Open {})?)
test_examples(Open {})
}
}

View File

@ -175,6 +175,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Command {})?)
test_examples(Command {})
}
}

View File

@ -104,6 +104,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(PathBasename {})?)
test_examples(PathBasename {})
}
}

View File

@ -35,6 +35,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(Path {})?)
test_examples(Path {})
}
}

View File

@ -150,6 +150,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(PathDirname {})?)
test_examples(PathDirname {})
}
}

View File

@ -72,6 +72,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(PathExists {})?)
test_examples(PathExists {})
}
}

View File

@ -77,6 +77,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(PathExpand {})?)
test_examples(PathExpand {})
}
}

View File

@ -93,6 +93,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(PathExtension {})?)
test_examples(PathExtension {})
}
}

View File

@ -167,6 +167,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
Ok(test_examples(PathFilestem {})?)
test_examples(PathFilestem {})
}
}

Some files were not shown because too many files have changed in this diff Show More