This commit is contained in:
harupy 2022-09-11 22:46:07 +09:00
parent a780faccd5
commit 13566989b6
2 changed files with 6 additions and 6 deletions

View File

@ -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" name == "l" || name == "I" || name == "O"
} }
/// Check AmbiguousVariableName compliance.
pub fn check_ambiguous_variable_name(name: &str, location: Location) -> Option<Check> { pub fn check_ambiguous_variable_name(name: &str, location: Location) -> Option<Check> {
if is_ambiguous_name(name) { if is_ambiguous_name(name) {
Some(Check::new( Some(Check::new(

View File

@ -965,11 +965,10 @@ impl<'a> Checker<'a> {
} }
} }
if self.settings.select.contains(&CheckCode::E741) && checks::is_ambiguous_name(id) { if self.settings.select.contains(&CheckCode::E741) {
self.checks.push(Check::new( if let Some(check) = checks::check_ambiguous_variable_name(id, expr.location) {
CheckKind::AmbiguousVariableName(id.to_string()), self.checks.push(check);
expr.location, }
));
} }
// TODO(charlie): Handle alternate binding types (like `Annotation`). // TODO(charlie): Handle alternate binding types (like `Annotation`).