Improve search for duplicates (#53)

This commit is contained in:
Dmitry Dygalo 2022-08-31 14:23:43 +02:00 committed by GitHub
parent 1e67ce229f
commit 9e3c35e6dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}
}