Skip to content

Commit 6be1919

Browse files
larseggertdjc
authored andcommitted
chore: Fix unnecessary_unwrap clippy
``` warning: called `unwrap` on `self.exit_probe_rtt_at` after checking its variant with `is_none` --> quinn-proto/src/congestion/bbr/mod.rs:247:48 | 238 | if self.exit_probe_rtt_at.is_none() { | ----------------------------------- help: try: `if let Some(<item>) = self.exit_probe_rtt_at` ... 247 | } else if is_round_start && now >= self.exit_probe_rtt_at.unwrap() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap = note: `#[warn(clippy::unnecessary_unwrap)]` on by default ```
1 parent 4de6d2c commit 6be1919

File tree

1 file changed

+17
-13
lines changed
  • quinn-proto/src/congestion/bbr

1 file changed

+17
-13
lines changed

quinn-proto/src/congestion/bbr/mod.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,21 +235,25 @@ impl Bbr {
235235
}
236236

237237
if self.mode == Mode::ProbeRtt {
238-
if self.exit_probe_rtt_at.is_none() {
239-
// If the window has reached the appropriate size, schedule exiting
240-
// ProbeRtt. The CWND during ProbeRtt is
241-
// kMinimumCongestionWindow, but we allow an extra packet since QUIC
242-
// checks CWND before sending a packet.
243-
if bytes_in_flight < self.get_probe_rtt_cwnd() + self.current_mtu {
244-
const K_PROBE_RTT_TIME: Duration = Duration::from_millis(200);
245-
self.exit_probe_rtt_at = Some(now + K_PROBE_RTT_TIME);
238+
match self.exit_probe_rtt_at {
239+
None => {
240+
// If the window has reached the appropriate size, schedule exiting
241+
// ProbeRtt. The CWND during ProbeRtt is
242+
// kMinimumCongestionWindow, but we allow an extra packet since QUIC
243+
// checks CWND before sending a packet.
244+
if bytes_in_flight < self.get_probe_rtt_cwnd() + self.current_mtu {
245+
const K_PROBE_RTT_TIME: Duration = Duration::from_millis(200);
246+
self.exit_probe_rtt_at = Some(now + K_PROBE_RTT_TIME);
247+
}
246248
}
247-
} else if is_round_start && now >= self.exit_probe_rtt_at.unwrap() {
248-
if !self.is_at_full_bandwidth {
249-
self.enter_startup_mode();
250-
} else {
251-
self.enter_probe_bandwidth_mode(now);
249+
Some(exit_time) if is_round_start && now >= exit_time => {
250+
if !self.is_at_full_bandwidth {
251+
self.enter_startup_mode();
252+
} else {
253+
self.enter_probe_bandwidth_mode(now);
254+
}
252255
}
256+
Some(_) => {}
253257
}
254258
}
255259

0 commit comments

Comments
 (0)