forked from extern/nushell
Use clippy-recommended simplification (#7904)
# Description Just a couple clippy-recommended simplifications. # User-Facing Changes _(List of all changes that impact the user experience here. This helps us keep track of breaking changes.)_ # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
parent
ed65886ae5
commit
421bc828ef
@ -20,7 +20,7 @@ mod test_examples {
|
|||||||
engine::{Command, EngineState, Stack, StateDelta, StateWorkingSet},
|
engine::{Command, EngineState, Stack, StateDelta, StateWorkingSet},
|
||||||
Example, PipelineData, Signature, Span, Type, Value,
|
Example, PipelineData, Signature, Span, Type, Value,
|
||||||
};
|
};
|
||||||
use std::{collections::HashSet, path::PathBuf};
|
use std::collections::HashSet;
|
||||||
|
|
||||||
pub fn test_examples(cmd: impl Command + 'static) {
|
pub fn test_examples(cmd: impl Command + 'static) {
|
||||||
let examples = cmd.examples();
|
let examples = cmd.examples();
|
||||||
@ -45,7 +45,7 @@ mod test_examples {
|
|||||||
signature.vectorizes_over_list,
|
signature.vectorizes_over_list,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
check_example_evaluates_to_expected_output(&example, &cwd, &mut engine_state);
|
check_example_evaluates_to_expected_output(&example, cwd.as_path(), &mut engine_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_signature_input_output_types_entries_have_examples(
|
check_all_signature_input_output_types_entries_have_examples(
|
||||||
@ -104,7 +104,7 @@ mod test_examples {
|
|||||||
|
|
||||||
fn check_example_input_and_output_types_match_command_signature(
|
fn check_example_input_and_output_types_match_command_signature(
|
||||||
example: &Example,
|
example: &Example,
|
||||||
cwd: &PathBuf,
|
cwd: &std::path::Path,
|
||||||
engine_state: &mut Box<EngineState>,
|
engine_state: &mut Box<EngineState>,
|
||||||
signature_input_output_types: &Vec<(Type, Type)>,
|
signature_input_output_types: &Vec<(Type, Type)>,
|
||||||
signature_operates_on_cell_paths: bool,
|
signature_operates_on_cell_paths: bool,
|
||||||
@ -204,7 +204,7 @@ mod test_examples {
|
|||||||
|
|
||||||
fn check_example_evaluates_to_expected_output(
|
fn check_example_evaluates_to_expected_output(
|
||||||
example: &Example,
|
example: &Example,
|
||||||
cwd: &PathBuf,
|
cwd: &std::path::Path,
|
||||||
engine_state: &mut Box<EngineState>,
|
engine_state: &mut Box<EngineState>,
|
||||||
) {
|
) {
|
||||||
let mut stack = Stack::new();
|
let mut stack = Stack::new();
|
||||||
@ -260,7 +260,7 @@ mod test_examples {
|
|||||||
fn eval(
|
fn eval(
|
||||||
contents: &str,
|
contents: &str,
|
||||||
input: PipelineData,
|
input: PipelineData,
|
||||||
cwd: &PathBuf,
|
cwd: &std::path::Path,
|
||||||
engine_state: &mut Box<EngineState>,
|
engine_state: &mut Box<EngineState>,
|
||||||
) -> Value {
|
) -> Value {
|
||||||
let (block, delta) = parse(contents, engine_state);
|
let (block, delta) = parse(contents, engine_state);
|
||||||
@ -282,7 +282,7 @@ mod test_examples {
|
|||||||
fn eval_block(
|
fn eval_block(
|
||||||
block: Block,
|
block: Block,
|
||||||
input: PipelineData,
|
input: PipelineData,
|
||||||
cwd: &PathBuf,
|
cwd: &std::path::Path,
|
||||||
engine_state: &mut Box<EngineState>,
|
engine_state: &mut Box<EngineState>,
|
||||||
delta: StateDelta,
|
delta: StateDelta,
|
||||||
) -> Value {
|
) -> Value {
|
||||||
@ -302,7 +302,7 @@ mod test_examples {
|
|||||||
|
|
||||||
fn eval_pipeline_without_terminal_expression(
|
fn eval_pipeline_without_terminal_expression(
|
||||||
src: &str,
|
src: &str,
|
||||||
cwd: &PathBuf,
|
cwd: &std::path::Path,
|
||||||
engine_state: &mut Box<EngineState>,
|
engine_state: &mut Box<EngineState>,
|
||||||
) -> Option<Value> {
|
) -> Option<Value> {
|
||||||
let (mut block, delta) = parse(src, engine_state);
|
let (mut block, delta) = parse(src, engine_state);
|
||||||
|
Loading…
Reference in New Issue
Block a user