Apply nightly clippy fixes (#9381)

# Description
New lints coming from `cargo +nightly clippy`

Manually checked for problems.


# User-Facing Changes
None

# Tests + Formatting
(-)
This commit is contained in:
Stefan Holderbach 2023-06-08 18:49:58 +02:00 committed by GitHub
parent 74ba00a222
commit a5dd93d154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 23 deletions

View File

@ -18,7 +18,7 @@ impl SQLContext {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
table_map: HashMap::new(), table_map: HashMap::new(),
dialect: GenericDialect::default(), dialect: GenericDialect,
} }
} }

View File

@ -107,7 +107,7 @@ mod tests {
let style = color_string_to_nustyle(color_string); let style = color_string_to_nustyle(color_string);
assert_eq!(style.foreground, Some(Color::Black)); assert_eq!(style.foreground, Some(Color::Black));
assert_eq!(style.background, Some(Color::White)); assert_eq!(style.background, Some(Color::White));
assert_eq!(style.is_bold, true); assert!(style.is_bold);
} }
#[test] #[test]

View File

@ -258,7 +258,7 @@ mod tests {
..Default::default() ..Default::default()
}), }),
}; };
assert_eq!(text_style.is_bold(), true); assert!(text_style.is_bold());
} }
#[test] #[test]
@ -270,7 +270,7 @@ mod tests {
}), }),
}; };
let dimmed_style = text_style.dimmed(); let dimmed_style = text_style.dimmed();
assert_eq!(dimmed_style.is_dimmed(), true); assert!(dimmed_style.is_dimmed());
} }
#[test] #[test]
@ -282,7 +282,7 @@ mod tests {
..Default::default() ..Default::default()
}), }),
}; };
assert_eq!(text_style.is_dimmed(), true); assert!(text_style.is_dimmed());
} }
#[test] #[test]
@ -294,7 +294,7 @@ mod tests {
}), }),
}; };
let italic_style = text_style.italic(); let italic_style = text_style.italic();
assert_eq!(italic_style.is_italic(), true); assert!(italic_style.is_italic());
} }
#[test] #[test]
@ -306,7 +306,7 @@ mod tests {
..Default::default() ..Default::default()
}), }),
}; };
assert_eq!(text_style.is_italic(), true); assert!(text_style.is_italic());
} }
#[test] #[test]
@ -318,7 +318,7 @@ mod tests {
}), }),
}; };
let underline_style = text_style.underline(); let underline_style = text_style.underline();
assert_eq!(underline_style.is_underline(), true); assert!(underline_style.is_underline());
} }
#[test] #[test]
@ -330,7 +330,7 @@ mod tests {
..Default::default() ..Default::default()
}), }),
}; };
assert_eq!(text_style.is_underline(), true); assert!(text_style.is_underline());
} }
#[test] #[test]
@ -342,7 +342,7 @@ mod tests {
}), }),
}; };
let blink_style = text_style.blink(); let blink_style = text_style.blink();
assert_eq!(blink_style.is_blink(), true); assert!(blink_style.is_blink());
} }
#[test] #[test]
@ -354,7 +354,7 @@ mod tests {
..Default::default() ..Default::default()
}), }),
}; };
assert_eq!(text_style.is_blink(), true); assert!(text_style.is_blink());
} }
#[test] #[test]
@ -366,7 +366,7 @@ mod tests {
}), }),
}; };
let reverse_style = text_style.reverse(); let reverse_style = text_style.reverse();
assert_eq!(reverse_style.is_reverse(), true); assert!(reverse_style.is_reverse());
} }
#[test] #[test]
@ -378,7 +378,7 @@ mod tests {
..Default::default() ..Default::default()
}), }),
}; };
assert_eq!(text_style.is_reverse(), true); assert!(text_style.is_reverse());
} }
#[test] #[test]
@ -390,7 +390,7 @@ mod tests {
}), }),
}; };
let hidden_style = text_style.hidden(); let hidden_style = text_style.hidden();
assert_eq!(hidden_style.is_hidden(), true); assert!(hidden_style.is_hidden());
} }
#[test] #[test]
@ -402,7 +402,7 @@ mod tests {
..Default::default() ..Default::default()
}), }),
}; };
assert_eq!(text_style.is_hidden(), true); assert!(text_style.is_hidden());
} }
#[test] #[test]
@ -414,7 +414,7 @@ mod tests {
}), }),
}; };
let strikethrough_style = text_style.strikethrough(); let strikethrough_style = text_style.strikethrough();
assert_eq!(strikethrough_style.is_strikethrough(), true); assert!(strikethrough_style.is_strikethrough());
} }
#[test] #[test]
@ -426,6 +426,6 @@ mod tests {
..Default::default() ..Default::default()
}), }),
}; };
assert_eq!(text_style.is_strikethrough(), true); assert!(text_style.is_strikethrough());
} }
} }

View File

@ -176,7 +176,6 @@ fn get_arguments(engine_state: &EngineState, stack: &mut Stack, call: Call) -> V
span: name.span, span: name.span,
}; };
arg_value.push(rec); arg_value.push(rec);
} else {
}; };
if let Some(expression) = opt_expr { if let Some(expression) = opt_expr {
@ -207,7 +206,6 @@ fn get_arguments(engine_state: &EngineState, stack: &mut Stack, call: Call) -> V
span: expression.span, span: expression.span,
}; };
arg_value.push(rec); arg_value.push(rec);
} else {
}; };
} }
Argument::Positional(inner_expr) => { Argument::Positional(inner_expr) => {

View File

@ -117,7 +117,7 @@ fn split_words(
// let ignore_punctuation = call.has_flag("ignore-punctuation"); // let ignore_punctuation = call.has_flag("ignore-punctuation");
let word_length: Option<usize> = call.get_flag(engine_state, stack, "min-word-length")?; let word_length: Option<usize> = call.get_flag(engine_state, stack, "min-word-length")?;
if matches!(word_length, None) { if word_length.is_none() {
if call.has_flag("grapheme-clusters") { if call.has_flag("grapheme-clusters") {
return Err(ShellError::IncompatibleParametersSingle { return Err(ShellError::IncompatibleParametersSingle {
msg: "--grapheme-clusters (-g) requires --min-word-length (-l)".to_string(), msg: "--grapheme-clusters (-g) requires --min-word-length (-l)".to_string(),

View File

@ -111,7 +111,7 @@ pub fn create_commands(registry: &mut CommandRegistry) {
registry.register_command_view(ConfigCmd::default(), true); registry.register_command_view(ConfigCmd::default(), true);
registry.register_command_view(HelpCmd::default(), true); registry.register_command_view(HelpCmd::default(), true);
registry.register_command_reactive(QuitCmd::default()); registry.register_command_reactive(QuitCmd);
registry.register_command_reactive(TweakCmd::default()); registry.register_command_reactive(TweakCmd::default());
} }

View File

@ -464,7 +464,7 @@ pub fn parse_def(
*declaration = signature.clone().into_block_command(block_id); *declaration = signature.clone().into_block_command(block_id);
let mut block = working_set.get_block_mut(block_id); let block = working_set.get_block_mut(block_id);
let calls_itself = block_calls_itself(block, decl_id); let calls_itself = block_calls_itself(block, decl_id);
block.recursive = Some(calls_itself); block.recursive = Some(calls_itself);
block.signature = signature; block.signature = signature;

View File

@ -1587,7 +1587,7 @@ pub fn parse_brace_expr(
.get(1) .get(1)
.map(|token| working_set.get_span_contents(token.span)); .map(|token| working_set.get_span_contents(token.span));
if matches!(second_token, None) { if second_token.is_none() {
// If we're empty, that means an empty record or closure // If we're empty, that means an empty record or closure
if matches!(shape, SyntaxShape::Closure(_)) { if matches!(shape, SyntaxShape::Closure(_)) {
parse_closure_expression(working_set, shape, span) parse_closure_expression(working_set, shape, span)