mirror of https://github.com/astral-sh/ruff
Refactor
This commit is contained in:
parent
a780faccd5
commit
13566989b6
|
|
@ -93,10 +93,11 @@ pub fn check_do_not_assign_lambda(value: &Expr, location: Location) -> Option<Ch
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_ambiguous_name(name: &str) -> bool {
|
||||
fn is_ambiguous_name(name: &str) -> bool {
|
||||
name == "l" || name == "I" || name == "O"
|
||||
}
|
||||
|
||||
/// Check AmbiguousVariableName compliance.
|
||||
pub fn check_ambiguous_variable_name(name: &str, location: Location) -> Option<Check> {
|
||||
if is_ambiguous_name(name) {
|
||||
Some(Check::new(
|
||||
|
|
|
|||
|
|
@ -965,11 +965,10 @@ impl<'a> Checker<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
if self.settings.select.contains(&CheckCode::E741) && checks::is_ambiguous_name(id) {
|
||||
self.checks.push(Check::new(
|
||||
CheckKind::AmbiguousVariableName(id.to_string()),
|
||||
expr.location,
|
||||
));
|
||||
if self.settings.select.contains(&CheckCode::E741) {
|
||||
if let Some(check) = checks::check_ambiguous_variable_name(id, expr.location) {
|
||||
self.checks.push(check);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(charlie): Handle alternate binding types (like `Annotation`).
|
||||
|
|
|
|||
Loading…
Reference in New Issue