martin-g commented on code in PR #2433:
URL: https://github.com/apache/avro/pull/2433#discussion_r1289625290
##########
lang/rust/avro/src/schema.rs:
##########
@@ -1440,7 +1440,12 @@ impl Parser {
.collect::<Result<_, _>>()
})?;
+ let mut existing_fields: HashSet<&String> =
HashSet::with_capacity(fields.len());
for field in &fields {
+ if existing_fields.contains(&field.name) {
+ return Err(Error::FieldNameDuplicate(field.name.clone()));
+ }
+ existing_fields.insert(&field.name);
Review Comment:
Do we need the new data structure ?
We can use the returned value of
https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.insert to
decide whether to return an error or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]