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

Commit

Permalink
Format and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeling committed Oct 23, 2023
1 parent faab82e commit 6f89dc3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
5 changes: 1 addition & 4 deletions kuksa_databroker/databroker/src/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2789,10 +2789,7 @@ mod tests {
.expect("Register datapoint should succeed");

let mut stream = broker
.subscribe(HashMap::from([(
id1,
HashSet::from([Field::Datapoint]),
)]))
.subscribe(HashMap::from([(id1, HashSet::from([Field::Datapoint]))]))
.await
.expect("subscription should succeed");

Expand Down
44 changes: 22 additions & 22 deletions kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,30 +385,30 @@ impl proto::val_server::Val for broker::DataBroker {

let regex_exp = glob::to_regex(&entry.path);
if let Ok(regex) = regex_exp {
broker.for_each_entry(|for_each_entry| {
let entry_path = &for_each_entry.metadata().path;
if regex.is_match(entry_path) {
let mut fields = HashSet::new();
for id in &entry.fields {
match proto::Field::from_i32(*id) {
Some(field) => match field {
proto::Field::Value => {
fields.insert(broker::Field::Datapoint);
}
proto::Field::ActuatorTarget => {
fields.insert(broker::Field::ActuatorTarget);
}
_ => {
// Just ignore other fields for now
broker
.for_each_entry(|for_each_entry| {
let entry_path = &for_each_entry.metadata().path;
if regex.is_match(entry_path) {
let mut fields = HashSet::new();
for id in &entry.fields {
if let Some(field) = proto::Field::from_i32(*id) {
match field {
proto::Field::Value => {
fields.insert(broker::Field::Datapoint);
}
proto::Field::ActuatorTarget => {
fields.insert(broker::Field::ActuatorTarget);
}
_ => {
// Just ignore other fields for now
}
}
},
None => {}
};
};
}
entries.insert(for_each_entry.metadata().id, fields);
}
entries.insert(for_each_entry.metadata().id, fields);
}
})
.await;
})
.await;
}
}

Expand Down

0 comments on commit 6f89dc3

Please sign in to comment.