refactor(connlib): reduce indentation when looping over gateways (#5944)

By leveraging `let-else`, we can perform the main action - pushing to
the buffered transmits - on first indentation level of the loop.
This commit is contained in:
Thomas Eizinger
2024-07-23 00:53:54 +10:00
committed by GitHub
parent 286ca77725
commit fa58e27883

View File

@@ -379,10 +379,12 @@ impl TunnelTest {
});
for (_, gateway) in self.gateways.iter_mut() {
if let Some(transmit) = gateway.exec_mut(|g| g.sut.poll_transmit()) {
buffered_transmits.push(transmit, gateway);
continue 'outer;
}
let Some(transmit) = gateway.exec_mut(|g| g.sut.poll_transmit()) else {
continue;
};
buffered_transmits.push(transmit, gateway);
continue 'outer;
}
for (id, gateway) in self.gateways.iter_mut() {