mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Fix some clippy lints that were 'allow'ed
This commit is contained in:
12 files changed
+28
-49
No files matched your search
+7
-10
@@ -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(())
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user