Fix some nightly clippy warnings (#329)

This commit is contained in:
JT 2021-11-13 13:42:13 +13:00 committed by GitHub
parent db2bca56c9
commit 14a2918bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 34 deletions

7
Cargo.lock generated
View File

@ -156,9 +156,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.0.71"
version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd"
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
[[package]]
name = "cfg-if"
@ -807,6 +807,7 @@ dependencies = [
"nu-term-grid",
"rand",
"rayon",
"regex",
"serde",
"serde_urlencoded",
"serde_yaml",
@ -1227,7 +1228,7 @@ dependencies = [
[[package]]
name = "reedline"
version = "0.2.0"
source = "git+https://github.com/nushell/reedline?branch=main#1b244992981e392152b86ceed5c583c31150976c"
source = "git+https://github.com/nushell/reedline?branch=main#c11aef2d9b4eaf0c762f1349f641534597815295"
dependencies = [
"chrono",
"crossterm 0.22.1",

View File

@ -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(

View File

@ -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![];

View File

@ -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;

View File

@ -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,
))
});