mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
Update clippy to check all features (#441)
* Update clippy to check all features * Fix tests * oops
This commit is contained in:
parent
9548e5ef5b
commit
fdde95f675
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
}
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
mod nu_dataframe;
|
||||
mod values;
|
||||
|
||||
mod describe;
|
||||
mod dtypes;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use super::nu_dataframe::NuDataFrame;
|
||||
use super::values::NuDataFrame;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
|
@ -1,4 +1,4 @@
|
||||
use super::nu_dataframe::{Column, NuDataFrame};
|
||||
use super::values::{Column, NuDataFrame};
|
||||
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
|
@ -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()))
|
||||
}
|
@ -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() {
|
||||
|
25
src/tests.rs
25
src/tests.rs
@ -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"
|
||||
}
|
||||
]"#,
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user