Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
use entry and extend

Co-authored-by: John Argérus <[email protected]>
  • Loading branch information
rafaeling and argerus authored Oct 23, 2023
1 parent a259d1b commit eefb7cb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,12 @@ impl proto::val_server::Val for broker::DataBroker {
.for_each_entry(|entry| {
let entry_path = &entry.metadata().path;
if regex.is_match(entry_path) {
let id = &entry.metadata().id;
match entries.get(id) {
Some(fields) => {
let joined_set: HashSet<_> =
fields.union(&fields_set).cloned().collect();
entries.insert(*id, joined_set);
}
None => {
entries.insert(*id, fields_set.clone());
}
}
entries
.entry(entry.metadata().id)
.and_modify(|existing_fields| {
existing_fields.extend(fields.clone());
})
.or_insert(fields.clone());
}
})
.await;
Expand Down

0 comments on commit eefb7cb

Please sign in to comment.