Fix some clippy lints that were 'allow'ed

This commit is contained in:
Noah committed 2020-04-05 14:55:51 -05:00
1 parent f5de59a4bd
commit d4bda6c02e
12 files changed
+28 -49

No files matched your search

+7 -10
View File
@@ -6,7 +6,6 @@ use crate::error::{LexicalError, LexicalErrorType};
type ParameterDefs = (Vec<ast::Parameter>, Vec<ast::Expression>);
type ParameterDef = (ast::Parameter, Option<ast::Expression>);
#[allow(clippy::collapsible_if)]
pub fn parse_params(
params: (Vec<ParameterDef>, Vec<ParameterDef>),
) -> Result<ParameterDefs, LexicalError> {
@@ -16,15 +15,13 @@ pub fn parse_params(
let mut try_default = |name: &ast::Parameter, default| {
if let Some(default) = default {
defaults.push(default);
} else {
if !defaults.is_empty() {
// Once we have started with defaults, all remaining arguments must
// have defaults
return Err(LexicalError {
error: LexicalErrorType::DefaultArgumentError,
location: name.location,
});
}
} else if !defaults.is_empty() {
// Once we have started with defaults, all remaining arguments must
// have defaults
return Err(LexicalError {
error: LexicalErrorType::DefaultArgumentError,
location: name.location,
});
}
Ok(())
};