mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:10:09 +00:00
Improve search for duplicates (#53)
This commit is contained in:
parent
1e67ce229f
commit
9e3c35e6dc
1 changed files with 3 additions and 3 deletions
|
@ -372,17 +372,17 @@ impl Visitor for Checker<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for duplicates.
|
// Search for duplicates.
|
||||||
let mut idents: BTreeSet<String> = BTreeSet::new();
|
let mut idents: BTreeSet<&str> = BTreeSet::new();
|
||||||
for arg in all_arguments {
|
for arg in all_arguments {
|
||||||
let ident = &arg.node.arg;
|
let ident = &arg.node.arg;
|
||||||
if idents.contains(ident) {
|
if idents.contains(ident.as_str()) {
|
||||||
self.checks.push(Check {
|
self.checks.push(Check {
|
||||||
kind: CheckKind::DuplicateArgumentName,
|
kind: CheckKind::DuplicateArgumentName,
|
||||||
location: arg.location,
|
location: arg.location,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
idents.insert(ident.clone());
|
idents.insert(ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue