Run a round of clippy --fix to fix a ton of lints (#7006)

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
This commit is contained in:
Alex Saveau
2022-11-04 13:11:17 -07:00
committed by GitHub
parent f1bde69131
commit be5d71ea47
32 changed files with 51 additions and 53 deletions

View File

@ -347,14 +347,14 @@ impl Value {
eprintln!("$config.log_level is not a string")
}
}
"menus" => match create_menus(value, &config) {
"menus" => match create_menus(value) {
Ok(map) => config.menus = map,
Err(e) => {
eprintln!("$config.menus is not a valid list of menus");
eprintln!("{:?}", e);
}
},
"keybindings" => match create_keybindings(value, &config) {
"keybindings" => match create_keybindings(value) {
Ok(keybindings) => config.keybindings = keybindings,
Err(e) => {
eprintln!("$config.keybindings is not a valid keybindings list");
@ -599,7 +599,7 @@ fn create_hooks(value: &Value) -> Result<Hooks, ShellError> {
}
// Parses the config object to extract the strings that will compose a keybinding for reedline
fn create_keybindings(value: &Value, config: &Config) -> Result<Vec<ParsedKeybinding>, ShellError> {
fn create_keybindings(value: &Value) -> Result<Vec<ParsedKeybinding>, ShellError> {
match value {
Value::Record { cols, vals, span } => {
// Finding the modifier value in the record
@ -621,7 +621,7 @@ fn create_keybindings(value: &Value, config: &Config) -> Result<Vec<ParsedKeybin
Value::List { vals, .. } => {
let res = vals
.iter()
.map(|inner_value| create_keybindings(inner_value, config))
.map(create_keybindings)
.collect::<Result<Vec<Vec<ParsedKeybinding>>, ShellError>>();
let res = res?
@ -636,7 +636,7 @@ fn create_keybindings(value: &Value, config: &Config) -> Result<Vec<ParsedKeybin
}
// Parses the config object to extract the strings that will compose a keybinding for reedline
pub fn create_menus(value: &Value, config: &Config) -> Result<Vec<ParsedMenu>, ShellError> {
pub fn create_menus(value: &Value) -> Result<Vec<ParsedMenu>, ShellError> {
match value {
Value::Record { cols, vals, span } => {
// Finding the modifier value in the record
@ -667,7 +667,7 @@ pub fn create_menus(value: &Value, config: &Config) -> Result<Vec<ParsedMenu>, S
Value::List { vals, .. } => {
let res = vals
.iter()
.map(|inner_value| create_menus(inner_value, config))
.map(create_menus)
.collect::<Result<Vec<Vec<ParsedMenu>>, ShellError>>();
let res = res?.into_iter().flatten().collect::<Vec<ParsedMenu>>();

View File

@ -25,11 +25,11 @@ impl FromValue for Spanned<i64> {
span: *span,
}),
Value::Filesize { val, span } => Ok(Spanned {
item: *val as i64,
item: *val,
span: *span,
}),
Value::Duration { val, span } => Ok(Spanned {
item: *val as i64,
item: *val,
span: *span,
}),
@ -47,8 +47,8 @@ impl FromValue for i64 {
fn from_value(v: &Value) -> Result<Self, ShellError> {
match v {
Value::Int { val, .. } => Ok(*val),
Value::Filesize { val, .. } => Ok(*val as i64),
Value::Duration { val, .. } => Ok(*val as i64),
Value::Filesize { val, .. } => Ok(*val),
Value::Duration { val, .. } => Ok(*val),
v => Err(ShellError::CantConvert(
"integer".into(),