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