mirror of
https://github.com/nushell/nushell
synced 2024-11-10 07:04:13 +00:00
Fix clippy warnings (#4176)
This commit is contained in:
parent
c00853a473
commit
c08e145501
12 changed files with 277 additions and 264 deletions
477
Cargo.lock
generated
477
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,7 +0,0 @@
|
|||
use derive_new::new;
|
||||
use nu_protocol::hir;
|
||||
|
||||
#[derive(new, Debug)]
|
||||
pub(crate) struct Command {
|
||||
pub(crate) args: hir::Call,
|
||||
}
|
|
@ -1,5 +1 @@
|
|||
mod dynamic;
|
||||
pub(crate) mod external;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
pub(crate) use dynamic::Command as DynamicCommand;
|
||||
|
|
|
@ -11,12 +11,6 @@ use nu_protocol::{
|
|||
|
||||
pub struct WithEnv;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct WithEnvArgs {
|
||||
variable: Value,
|
||||
block: CapturedBlock,
|
||||
}
|
||||
|
||||
impl WholeStreamCommand for WithEnv {
|
||||
fn name(&self) -> &str {
|
||||
"with-env"
|
||||
|
|
|
@ -163,7 +163,7 @@ fn get_current_date() -> (i32, u32, u32) {
|
|||
|
||||
fn add_months_of_year_to_table(
|
||||
args: &CommandArgs,
|
||||
mut calendar_vec_deque: &mut VecDeque<Value>,
|
||||
calendar_vec_deque: &mut VecDeque<Value>,
|
||||
tag: &Tag,
|
||||
selected_year: i32,
|
||||
(start_month, end_month): (u32, u32),
|
||||
|
@ -181,7 +181,7 @@ fn add_months_of_year_to_table(
|
|||
|
||||
let add_month_to_table_result = add_month_to_table(
|
||||
args,
|
||||
&mut calendar_vec_deque,
|
||||
calendar_vec_deque,
|
||||
tag,
|
||||
selected_year,
|
||||
month_number,
|
||||
|
|
|
@ -6,12 +6,6 @@ use nu_protocol::{Dictionary, Signature, UntaggedValue};
|
|||
|
||||
pub struct TermSize;
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
pub struct TermSizeArgs {
|
||||
wide: bool,
|
||||
tall: bool,
|
||||
}
|
||||
|
||||
impl WholeStreamCommand for TermSize {
|
||||
fn name(&self) -> &str {
|
||||
"term size"
|
||||
|
|
|
@ -8,22 +8,13 @@ use std::collections::HashMap;
|
|||
|
||||
const COMMANDS_DOCS_DIR: &str = "docs/commands";
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct DocumentationConfig {
|
||||
no_subcommands: bool,
|
||||
no_color: bool,
|
||||
brief: bool,
|
||||
}
|
||||
|
||||
impl Default for DocumentationConfig {
|
||||
fn default() -> Self {
|
||||
DocumentationConfig {
|
||||
no_subcommands: false,
|
||||
no_color: false,
|
||||
brief: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_doc(name: &str, scope: &Scope) -> IndexMap<String, Value> {
|
||||
let mut row_entries = IndexMap::new();
|
||||
let command = scope
|
||||
|
|
|
@ -34,7 +34,7 @@ impl FileStructure {
|
|||
self.resources
|
||||
.iter()
|
||||
.map(|f| (PathBuf::from(&f.loc), f.at))
|
||||
.map(|f| to(f))
|
||||
.map(to)
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ pub struct NuError {
|
|||
pub output: Option<Outcome>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct NuProcess {
|
||||
pub arguments: Vec<OsString>,
|
||||
pub environment_vars: Vec<EnvironmentVariable>,
|
||||
|
@ -52,16 +52,6 @@ impl fmt::Display for NuProcess {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for NuProcess {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
arguments: vec![],
|
||||
environment_vars: Vec::default(),
|
||||
cwd: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NuProcess {
|
||||
pub fn arg<T: AsRef<OsStr>>(&mut self, arg: T) -> &mut Self {
|
||||
self.arguments.push(arg.as_ref().to_os_string());
|
||||
|
|
|
@ -20,8 +20,7 @@ const DEFAULT_LINE_COLORS: [Color; 5] = [
|
|||
];
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Line<'a> {
|
||||
title: &'a str,
|
||||
pub struct Line {
|
||||
x_labels: Vec<String>,
|
||||
x_range: [f64; 2],
|
||||
y_range: [f64; 2],
|
||||
|
@ -29,10 +28,9 @@ pub struct Line<'a> {
|
|||
data: Vec<Vec<(f64, f64)>>,
|
||||
}
|
||||
|
||||
impl<'a> Line<'a> {
|
||||
pub fn from_model(model: &'a Model) -> Result<Line<'a>, ShellError> {
|
||||
impl<'a> Line {
|
||||
pub fn from_model(model: &'a Model) -> Result<Line, ShellError> {
|
||||
Ok(Line {
|
||||
title: "Line Chart",
|
||||
x_labels: model.labels.x.to_vec(),
|
||||
x_range: [
|
||||
model.ranges.0.start.as_u64()? as f64,
|
||||
|
|
|
@ -61,7 +61,7 @@ pub fn value_to_bson_value(v: &Value) -> Result<Bson, ShellError> {
|
|||
UntaggedValue::Primitive(Primitive::FilePath(s)) => Bson::String(s.display().to_string()),
|
||||
UntaggedValue::Table(l) => Bson::Array(
|
||||
l.iter()
|
||||
.map(|x| value_to_bson_value(x))
|
||||
.map(value_to_bson_value)
|
||||
.collect::<Result<_, _>>()?,
|
||||
),
|
||||
UntaggedValue::Block(_) | UntaggedValue::Primitive(Primitive::Range(_)) => Bson::Null,
|
||||
|
|
|
@ -47,7 +47,7 @@ impl TreeView {
|
|||
_ => value.clone(),
|
||||
};
|
||||
builder = builder.begin_child(desc.clone());
|
||||
Self::from_value_helper(&value, &mut builder);
|
||||
Self::from_value_helper(&value, builder);
|
||||
builder = builder.end_child();
|
||||
//entries.push((desc.name.clone(), value.borrow().copy()))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue