mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 06:05:27 +02:00
Fix ignored clippy lints (#12160)
# Description Fixes some ignored clippy lints. # User-Facing Changes Changes some signatures and return types to `&dyn Command` instead of `&Box<dyn Command`, but I believe this is only an internal change.
This commit is contained in:
@ -48,7 +48,6 @@ pub fn build_table(value: Value, description: String, termsize: usize) -> String
|
||||
|
||||
add_padding_to_widths(&mut widths);
|
||||
|
||||
#[allow(clippy::manual_clamp)]
|
||||
let width = val_table_width.max(desc_table_width).min(termsize);
|
||||
|
||||
let mut desc_table = Table::from_iter([[String::from("description"), desc]]);
|
||||
|
@ -39,7 +39,6 @@ pub fn try_interaction(
|
||||
(interaction, confirmed)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn get_interactive_confirmation(prompt: String) -> Result<bool, Box<dyn Error>> {
|
||||
let input = Input::new()
|
||||
.with_prompt(prompt)
|
||||
|
@ -66,7 +66,6 @@ impl Command for Reverse {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let metadata = input.metadata();
|
||||
|
||||
#[allow(clippy::needless_collect)]
|
||||
let v: Vec<_> = input.into_iter_strict(call.head)?.collect();
|
||||
let iter = v.into_iter().rev();
|
||||
Ok(iter.into_pipeline_data_with_metadata(metadata, engine_state.ctrlc.clone()))
|
||||
|
@ -41,9 +41,7 @@ pub fn boolean_fold(
|
||||
|
||||
let ctrlc = engine_state.ctrlc.clone();
|
||||
|
||||
// TODO: This Clippy lint is incorrectly triggered in our CI for come reason
|
||||
#[allow(clippy::needless_borrow)]
|
||||
let eval_block = get_eval_block(&engine_state);
|
||||
let eval_block = get_eval_block(engine_state);
|
||||
|
||||
for value in input.into_interruptible_iter(ctrlc) {
|
||||
// with_env() is used here to ensure that each iteration uses
|
||||
|
@ -7,7 +7,6 @@ use nu_protocol::{
|
||||
record, span, Category, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData,
|
||||
ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use std::borrow::Borrow;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct HelpCommands;
|
||||
@ -127,7 +126,7 @@ fn build_help_commands(engine_state: &EngineState, span: Span) -> Vec<Value> {
|
||||
|
||||
for (_, decl_id) in commands {
|
||||
let decl = engine_state.get_decl(decl_id);
|
||||
let sig = decl.signature().update_from_command(decl.borrow());
|
||||
let sig = decl.signature().update_from_command(decl);
|
||||
|
||||
let key = sig.name;
|
||||
let usage = sig.usage;
|
||||
|
@ -421,7 +421,6 @@ pub struct RequestFlags {
|
||||
pub full: bool,
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_return)]
|
||||
fn transform_response_using_content_type(
|
||||
engine_state: &EngineState,
|
||||
stack: &mut Stack,
|
||||
@ -464,9 +463,9 @@ fn transform_response_using_content_type(
|
||||
|
||||
let output = response_to_buffer(resp, engine_state, span);
|
||||
if flags.raw {
|
||||
return Ok(output);
|
||||
Ok(output)
|
||||
} else if let Some(ext) = ext {
|
||||
return match engine_state.find_decl(format!("from {ext}").as_bytes(), &[]) {
|
||||
match engine_state.find_decl(format!("from {ext}").as_bytes(), &[]) {
|
||||
Some(converter_id) => engine_state.get_decl(converter_id).run(
|
||||
engine_state,
|
||||
stack,
|
||||
@ -474,10 +473,10 @@ fn transform_response_using_content_type(
|
||||
output,
|
||||
),
|
||||
None => Ok(output),
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return Ok(output);
|
||||
};
|
||||
Ok(output)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_response_redirection(
|
||||
|
@ -109,7 +109,6 @@ fn detect_columns(
|
||||
let config = engine_state.get_config();
|
||||
let input = input.collect_string("", config)?;
|
||||
|
||||
#[allow(clippy::needless_collect)]
|
||||
let input: Vec<_> = input
|
||||
.lines()
|
||||
.skip(num_rows_to_skip.unwrap_or_default())
|
||||
|
@ -989,7 +989,6 @@ enum TableView {
|
||||
},
|
||||
}
|
||||
|
||||
#[allow(clippy::manual_filter)]
|
||||
fn maybe_strip_color(output: String, config: &Config) -> String {
|
||||
// the terminal is for when people do ls from vim, there should be no coloring there
|
||||
if !config.use_ansi_coloring || !std::io::stdout().is_terminal() {
|
||||
|
Reference in New Issue
Block a user