mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-01 09:22:19 +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.
|
||||
let mut idents: BTreeSet<String> = BTreeSet::new();
|
||||
let mut idents: BTreeSet<&str> = BTreeSet::new();
|
||||
for arg in all_arguments {
|
||||
let ident = &arg.node.arg;
|
||||
if idents.contains(ident) {
|
||||
if idents.contains(ident.as_str()) {
|
||||
self.checks.push(Check {
|
||||
kind: CheckKind::DuplicateArgumentName,
|
||||
location: arg.location,
|
||||
});
|
||||
break;
|
||||
}
|
||||
idents.insert(ident.clone());
|
||||
idents.insert(ident);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue