Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Schaeff committed Jan 15, 2025
1 parent feec718 commit d5e0440
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions backend/src/mock/bus_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,33 +179,30 @@ impl<'a, F: FieldElement> BusChecker<'a, F> {
},
)
// combine all the states to one
.reduce(
BusState::default,
|mut a, b| {
for (tuple, TupleState { sends, receives }) in b {
let TupleState {
sends: sends_a,
receives: receives_a,
} = a.entry(tuple).or_default();

for (bus_connection, count) in sends {
sends_a
.entry(bus_connection)
.and_modify(|sends| *sends += count)
.or_insert(count);
}
.reduce(BusState::default, |mut a, b| {
for (tuple, TupleState { sends, receives }) in b {
let TupleState {
sends: sends_a,
receives: receives_a,
} = a.entry(tuple).or_default();

for (bus_connection, count) in sends {
sends_a
.entry(bus_connection)
.and_modify(|sends| *sends += count)
.or_insert(count);
}

for (bus_connection, count) in receives {
receives_a
.entry(bus_connection)
.and_modify(|receives| *receives += count)
.or_insert(count);
}
for (bus_connection, count) in receives {
receives_a
.entry(bus_connection)
.and_modify(|receives| *receives += count)
.or_insert(count);
}
}

a
},
);
a
});

let mut errors = vec![];

Expand Down

0 comments on commit d5e0440

Please sign in to comment.