Skip to content

Commit ab70b03

Browse files
committed
fix(bbr): clippy warnings
1 parent b531036 commit ab70b03

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/socket/tcp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ impl RttEstimator {
197197
Duration::from_millis(self.rto as _)
198198
}
199199

200+
#[cfg(feature = "socket-tcp-bbr")]
200201
pub(super) fn min_rtt(&self) -> Duration {
201202
Duration::from_millis(self.srtt as _)
202203
}

src/socket/tcp/congestion.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub(super) trait Controller {
4343

4444
#[derive(Debug)]
4545
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
46+
#[allow(clippy::large_enum_variant)]
4647
pub(super) enum AnyController {
4748
None(no_control::NoControl),
4849

src/socket/tcp/congestion/bbr/bw_estimation.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,29 @@ impl BandwidthEstimation {
5959
return;
6060
}
6161

62-
let send_rate;
63-
if self.sent_time.unwrap() > self.prev_sent_time.unwrap() {
64-
send_rate = BandwidthEstimation::bw_from_delta(
62+
let send_rate = if self.sent_time.unwrap() > self.prev_sent_time.unwrap() {
63+
BandwidthEstimation::bw_from_delta(
6564
self.total_sent - self.prev_total_sent,
6665
self.sent_time.unwrap() - self.prev_sent_time.unwrap(),
6766
)
68-
.unwrap_or(0);
67+
.unwrap_or(0)
6968
} else {
70-
send_rate = u64::MAX; // will take the min of send and ack, so this is just a skip
71-
}
69+
u64::MAX // will take the min of send and ack, so this is just a skip
70+
};
7271

73-
let ack_rate;
74-
if let Some(prev_acked_time) = self.prev_acked_time {
72+
let ack_rate = if let Some(prev_acked_time) = self.prev_acked_time {
7573
if self.acked_time.unwrap() > prev_acked_time {
76-
ack_rate = BandwidthEstimation::bw_from_delta(
74+
BandwidthEstimation::bw_from_delta(
7775
self.total_acked - self.prev_total_acked,
7876
self.acked_time.unwrap() - prev_acked_time,
7977
)
80-
.unwrap_or(0);
78+
.unwrap_or(0)
8179
} else {
82-
ack_rate = 0;
80+
0
8381
}
8482
} else {
85-
ack_rate = 0;
86-
}
83+
0
84+
};
8785

8886
let bandwidth = send_rate.min(ack_rate);
8987
if !app_limited && self.max_filter.get() < bandwidth {

0 commit comments

Comments
 (0)