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:
JT 2023-01-30 11:31:35 +13:00 committed by GitHub
parent ed65886ae5
commit 421bc828ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@ mod test_examples {
engine::{Command, EngineState, Stack, StateDelta, StateWorkingSet},
Example, PipelineData, Signature, Span, Type, Value,
};
use std::{collections::HashSet, path::PathBuf};
use std::collections::HashSet;
pub fn test_examples(cmd: impl Command + 'static) {
let examples = cmd.examples();
@ -45,7 +45,7 @@ mod test_examples {
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(
@ -104,7 +104,7 @@ mod test_examples {
fn check_example_input_and_output_types_match_command_signature(
example: &Example,
cwd: &PathBuf,
cwd: &std::path::Path,
engine_state: &mut Box<EngineState>,
signature_input_output_types: &Vec<(Type, Type)>,
signature_operates_on_cell_paths: bool,
@ -204,7 +204,7 @@ mod test_examples {
fn check_example_evaluates_to_expected_output(
example: &Example,
cwd: &PathBuf,
cwd: &std::path::Path,
engine_state: &mut Box<EngineState>,
) {
let mut stack = Stack::new();
@ -260,7 +260,7 @@ mod test_examples {
fn eval(
contents: &str,
input: PipelineData,
cwd: &PathBuf,
cwd: &std::path::Path,
engine_state: &mut Box<EngineState>,
) -> Value {
let (block, delta) = parse(contents, engine_state);
@ -282,7 +282,7 @@ mod test_examples {
fn eval_block(
block: Block,
input: PipelineData,
cwd: &PathBuf,
cwd: &std::path::Path,
engine_state: &mut Box<EngineState>,
delta: StateDelta,
) -> Value {
@ -302,7 +302,7 @@ mod test_examples {
fn eval_pipeline_without_terminal_expression(
src: &str,
cwd: &PathBuf,
cwd: &std::path::Path,
engine_state: &mut Box<EngineState>,
) -> Option<Value> {
let (mut block, delta) = parse(src, engine_state);