Update clippy to check all features (#441)

* Update clippy to check all features

* Fix tests

* oops
This commit is contained in:
JT 2021-12-06 07:23:43 +13:00 committed by GitHub
parent 9548e5ef5b
commit fdde95f675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 33 additions and 17 deletions

View File

@ -29,7 +29,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: test
args: --all
args: --all --all-features
- uses: actions-rs/cargo@v1
with:
@ -39,4 +39,4 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect
args: --all --all-features -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect

View File

@ -1,4 +1,4 @@
use super::nu_dataframe::{Column, NuDataFrame};
use super::values::{Column, NuDataFrame};
use nu_protocol::{
ast::Call,
@ -103,7 +103,7 @@ fn command(
call: &Call,
input: PipelineData,
) -> Result<PipelineData, ShellError> {
let df = NuDataFrame::try_from_pipeline(input, call.head.clone())?;
let df = NuDataFrame::try_from_pipeline(input, call.head)?;
let names = ChunkedArray::<Utf8Type>::new_from_opt_slice(
"descriptor",

View File

@ -1,4 +1,4 @@
use super::nu_dataframe::{Column, NuDataFrame};
use super::values::{Column, NuDataFrame};
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
@ -60,7 +60,7 @@ fn command(
call: &Call,
input: PipelineData,
) -> Result<PipelineData, ShellError> {
let df = NuDataFrame::try_from_pipeline(input, call.head.clone())?;
let df = NuDataFrame::try_from_pipeline(input, call.head)?;
let mut dtypes: Vec<Value> = Vec::new();
let names: Vec<Value> = df
@ -76,12 +76,12 @@ fn command(
let dtype_str = dtype.to_string();
dtypes.push(Value::String {
val: dtype_str.into(),
val: dtype_str,
span: call.head,
});
Value::String {
val: v.to_string().into(),
val: v.to_string(),
span: call.head,
}
})

View File

@ -1,4 +1,4 @@
mod nu_dataframe;
mod values;
mod describe;
mod dtypes;

View File

@ -1,4 +1,4 @@
use super::nu_dataframe::NuDataFrame;
use super::values::NuDataFrame;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,

View File

@ -1,4 +1,4 @@
use super::nu_dataframe::{Column, NuDataFrame};
use super::values::{Column, NuDataFrame};
use nu_protocol::{
ast::Call,

View File

@ -531,6 +531,6 @@ pub fn from_parsed_columns(column_values: ColumnMap) -> Result<NuDataFrame, Shel
}
DataFrame::new(df_series)
.map(|df| NuDataFrame::new(df))
.map(NuDataFrame::new)
.map_err(|e| ShellError::LabeledError("Error creating dataframe".into(), e.to_string()))
}

View File

@ -242,6 +242,7 @@ fn rm_helper(call: &Call, args: RmArgs) -> Vec<Value> {
use std::io::Error;
result = if trash {
trash::delete(&f).map_err(|e: trash::Error| {
use std::io::ErrorKind;
Error::new(ErrorKind::Other, format!("{:?}", e))
})
} else if metadata.is_file() {

View File

@ -1190,21 +1190,36 @@ fn comment_skipping_2() -> TestResult {
#[test]
fn command_filter_reject_1() -> TestResult {
run_test("[[lang, gems]; [nu, 100]] | reject gems", "{lang: nu}")
run_test(
"[[lang, gems]; [nu, 100]] | reject gems | to json",
r#"[
{
"lang": "nu"
}
]"#,
)
}
#[test]
fn command_filter_reject_2() -> TestResult {
run_test(
"[[lang, gems, grade]; [nu, 100, a]] | reject gems grade",
"{lang: nu}",
"[[lang, gems, grade]; [nu, 100, a]] | reject gems grade | to json",
r#"[
{
"lang": "nu"
}
]"#,
)
}
#[test]
fn command_filter_reject_3() -> TestResult {
run_test(
"[[lang, gems, grade]; [nu, 100, a]] | reject grade gems",
"{lang: nu}",
"[[lang, gems, grade]; [nu, 100, a]] | reject grade gems | to json",
r#"[
{
"lang": "nu"
}
]"#,
)
}