mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Fix some nightly clippy warnings (#329)
This commit is contained in:
@ -98,11 +98,7 @@ pub fn sum(data: Vec<Value>, head: Span) -> Result<Value, ShellError> {
|
||||
| Value::Float { .. }
|
||||
| Value::Filesize { .. }
|
||||
| Value::Duration { .. } => {
|
||||
let new_value = acc.add(head, value);
|
||||
if new_value.is_err() {
|
||||
return new_value;
|
||||
}
|
||||
acc = new_value.expect("This should never trigger")
|
||||
acc = acc.add(head, value)?;
|
||||
}
|
||||
other => {
|
||||
return Err(ShellError::UnsupportedInput(
|
||||
@ -133,11 +129,7 @@ pub fn product(data: Vec<Value>, head: Span) -> Result<Value, ShellError> {
|
||||
for value in &data {
|
||||
match value {
|
||||
Value::Int { .. } | Value::Float { .. } => {
|
||||
let new_value = acc.mul(head, value);
|
||||
if new_value.is_err() {
|
||||
return new_value;
|
||||
}
|
||||
acc = new_value.expect("This should never trigger")
|
||||
acc = acc.mul(head, value)?;
|
||||
}
|
||||
other => {
|
||||
return Err(ShellError::UnsupportedInput(
|
||||
|
@ -4,6 +4,7 @@ use std::collections::HashMap;
|
||||
|
||||
const COMMANDS_DOCS_DIR: &str = "docs/commands";
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct DocumentationConfig {
|
||||
no_subcommands: bool,
|
||||
//FIXME: add back in color support
|
||||
@ -12,16 +13,6 @@ pub struct DocumentationConfig {
|
||||
brief: bool,
|
||||
}
|
||||
|
||||
impl Default for DocumentationConfig {
|
||||
fn default() -> Self {
|
||||
DocumentationConfig {
|
||||
no_subcommands: false,
|
||||
no_color: false,
|
||||
brief: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_doc(name: &str, engine_state: &EngineState) -> (Vec<String>, Vec<Value>) {
|
||||
let mut cols = vec![];
|
||||
let mut vals = vec![];
|
||||
|
@ -13,7 +13,7 @@ pub use lite_parse::{lite_parse, LiteBlock};
|
||||
pub use parse_keywords::{
|
||||
parse_alias, parse_def, parse_def_predecl, parse_let, parse_module, parse_use,
|
||||
};
|
||||
pub use parser::{find_captures_in_expr, parse, Import, VarDecl};
|
||||
pub use parser::{find_captures_in_expr, parse, Import};
|
||||
|
||||
#[cfg(feature = "plugin")]
|
||||
pub use parse_keywords::parse_plugin;
|
||||
|
@ -24,12 +24,6 @@ use crate::parse_keywords::parse_plugin;
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Import {}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct VarDecl {
|
||||
var_id: VarId,
|
||||
expression: Expression,
|
||||
}
|
||||
|
||||
pub fn garbage(span: Span) -> Expression {
|
||||
Expression::garbage(span)
|
||||
}
|
||||
@ -271,7 +265,7 @@ fn parse_short_flags(
|
||||
error = error.or_else(|| {
|
||||
Some(ParseError::UnknownFlag(
|
||||
sig.name.clone(),
|
||||
format!("-{}", String::from_utf8_lossy(contents).to_string()),
|
||||
format!("-{}", String::from_utf8_lossy(contents)),
|
||||
*first,
|
||||
))
|
||||
});
|
||||
@ -281,7 +275,7 @@ fn parse_short_flags(
|
||||
error = error.or_else(|| {
|
||||
Some(ParseError::UnknownFlag(
|
||||
sig.name.clone(),
|
||||
format!("-{}", String::from_utf8_lossy(contents).to_string()),
|
||||
format!("-{}", String::from_utf8_lossy(contents)),
|
||||
*first,
|
||||
))
|
||||
});
|
||||
@ -291,7 +285,7 @@ fn parse_short_flags(
|
||||
error = error.or_else(|| {
|
||||
Some(ParseError::UnknownFlag(
|
||||
sig.name.clone(),
|
||||
format!("-{}", String::from_utf8_lossy(contents).to_string()),
|
||||
format!("-{}", String::from_utf8_lossy(contents)),
|
||||
*first,
|
||||
))
|
||||
});
|
||||
@ -302,7 +296,7 @@ fn parse_short_flags(
|
||||
error = error.or_else(|| {
|
||||
Some(ParseError::UnknownFlag(
|
||||
sig.name.clone(),
|
||||
format!("-{}", String::from_utf8_lossy(contents).to_string()),
|
||||
format!("-{}", String::from_utf8_lossy(contents)),
|
||||
*first,
|
||||
))
|
||||
});
|
||||
|
Reference in New Issue
Block a user