Skip to content

Commit adc7ba9

Browse files
authored
build: address clippy issues from 1.84 (#2444)
1 parent 56117ed commit adc7ba9

File tree

21 files changed

+32
-37
lines changed

21 files changed

+32
-37
lines changed

dc/s2n-quic-dc/src/fixed_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ where
204204
// Scan each value and check if our requested needle is present.
205205
let values = self.values.read();
206206
for (value_idx, value) in values.iter().enumerate() {
207-
if value.as_ref().map_or(false, |(k, _)| *k == *needle) {
207+
if value.as_ref().is_some_and(|(k, _)| *k == *needle) {
208208
return Some(RwLockReadGuard::map(values, |values| {
209209
&values[value_idx].as_ref().unwrap().1
210210
}));

dc/s2n-quic-dc/src/packet/stream/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl Packet<'_> {
198198
let len = VarInt::try_from(self.payload.len()).ok()?;
199199
offset.checked_sub(len)
200200
})
201-
.map_or(false, |v| *v == 0)
201+
.is_some_and(|v| *v == 0)
202202
}
203203

204204
#[inline]

dc/s2n-quic-dc/src/stream/send/application/state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ impl State {
115115

116116
let has_more_app_data = credits.initial_len > total_payload_len;
117117

118-
let included_fin = reader.final_offset().map_or(false, |fin| {
119-
stream_offset.as_u64() + payload_len as u64 == fin.as_u64()
120-
});
118+
let included_fin = reader
119+
.final_offset()
120+
.is_some_and(|fin| stream_offset.as_u64() + payload_len as u64 == fin.as_u64());
121121

122122
let time_sent = clock.get_time();
123123
probes::on_transmit_stream(

quic/s2n-quic-core/src/buffer/reader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub trait Reader: Storage {
3131
/// Returns `true` if the reader has the final offset buffered
3232
#[inline]
3333
fn has_buffered_fin(&self) -> bool {
34-
self.final_offset().map_or(false, |fin| {
34+
self.final_offset().is_some_and(|fin| {
3535
let buffered_end = self
3636
.current_offset()
3737
.as_u64()
@@ -44,7 +44,7 @@ pub trait Reader: Storage {
4444
#[inline]
4545
fn is_consumed(&self) -> bool {
4646
self.final_offset()
47-
.map_or(false, |fin| fin == self.current_offset())
47+
.is_some_and(|fin| fin == self.current_offset())
4848
}
4949

5050
/// Skips the data in the reader until `offset` is reached, or the reader storage is exhausted.

quic/s2n-quic-core/src/buffer/reassembler.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,13 @@ impl Reassembler {
127127
#[inline]
128128
pub fn is_writing_complete(&self) -> bool {
129129
self.final_size()
130-
.map_or(false, |len| self.total_received_len() == len)
130+
.is_some_and(|len| self.total_received_len() == len)
131131
}
132132

133133
/// Returns true if the buffer has completely been read and the final size is known
134134
#[inline]
135135
pub fn is_reading_complete(&self) -> bool {
136-
self.final_size()
137-
.map_or(false, |len| self.cursors.start_offset == len)
136+
self.final_size() == Some(self.cursors.start_offset)
138137
}
139138

140139
/// Returns the final size of the stream, if known

quic/s2n-quic-core/src/buffer/reassembler/reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Storage for Reassembler {
4040
);
4141

4242
// if we have a final size and this slot overlaps it then return the entire thing
43-
let chunk = if self.cursors.final_size().map_or(false, |final_size| {
43+
let chunk = if self.cursors.final_size().is_some_and(|final_size| {
4444
final_size <= slot.end_allocated() && watermark >= slot.buffered_len()
4545
}) {
4646
slot.consume()

quic/s2n-quic-core/src/recovery/bandwidth/estimator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl Estimator {
347347
|app_limited_bytes| self.delivered_bytes > app_limited_bytes;
348348
if self
349349
.app_limited_delivered_bytes
350-
.map_or(false, is_app_limited_period_over)
350+
.is_some_and(is_app_limited_period_over)
351351
{
352352
// Clear app-limited field if bubble is ACKed and gone
353353
self.app_limited_delivered_bytes = None;

quic/s2n-quic-core/src/recovery/bbr/probe_bw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl State {
297297
//# return Now() > BBR.cycle_stamp + interval
298298

299299
self.cycle_start_timestamp
300-
.map_or(false, |cycle_stamp| now > cycle_stamp + interval)
300+
.is_some_and(|cycle_stamp| now > cycle_stamp + interval)
301301
}
302302

303303
/// Bandwidth probing can cause loss. To help coexistence with loss-based

quic/s2n-quic-core/src/recovery/bbr/windowed_filter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ impl<
8484

8585
#[inline]
8686
fn window_expired(&self, now: TimeType) -> bool {
87-
self.last_updated.map_or(false, |last_updated| {
88-
now - last_updated >= self.window_length
89-
})
87+
self.last_updated
88+
.is_some_and(|last_updated| now - last_updated >= self.window_length)
9089
}
9190
}
9291
//= https://tools.ietf.org/id/draft-cardwell-iccrg-bbr-congestion-control-02#4.5.3.2

quic/s2n-quic-core/src/recovery/persistent_congestion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl Calculator {
4646
//# potentially too few probes.
4747
ensure!(self
4848
.first_rtt_sample
49-
.map_or(false, |ts| packet_info.time_sent >= ts));
49+
.is_some_and(|ts| packet_info.time_sent >= ts));
5050

5151
// Check that this lost packet was sent on the same path
5252
//

0 commit comments

Comments
 (0)