Skip to content

Commit 905e109

Browse files
committed
Bump MSRV to 1.82 (for qlog -> serde_with)
1 parent d24f5c6 commit 905e109

6 files changed

Lines changed: 9 additions & 20 deletions

File tree

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
steps:
163163
- uses: actions/checkout@v6
164164
# Note that we must also update the README when changing the MSRV
165-
- uses: dtolnay/rust-toolchain@1.80.0
165+
- uses: dtolnay/rust-toolchain@1.82.0
166166
- uses: Swatinem/rust-cache@v2
167167
- run: cargo check --locked --lib --all-features -p quinn-udp -p quinn-proto -p quinn
168168

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default-members = ["quinn", "quinn-proto", "quinn-udp", "bench", "perf"]
44
resolver = "2"
55

66
[workspace.package]
7-
rust-version = "1.80.0"
7+
rust-version = "1.82.0"
88
edition = "2021"
99
license = "MIT OR Apache-2.0"
1010
repository = "https://github.com/quinn-rs/quinn"

quinn-proto/src/connection/mod.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,11 +1146,7 @@ impl Connection {
11461146
self.spaces[SpaceId::Data].pending.new_cids.push(frame);
11471147
});
11481148
// Update Timer::PushNewCid
1149-
if self
1150-
.timers
1151-
.get(Timer::PushNewCid)
1152-
.map_or(true, |x| x <= now)
1153-
{
1149+
if self.timers.get(Timer::PushNewCid).is_none_or(|x| x <= now) {
11541150
self.reset_cid_retirement();
11551151
}
11561152
}
@@ -1443,10 +1439,7 @@ impl Connection {
14431439
}
14441440
let new_largest = {
14451441
let space = &mut self.spaces[space];
1446-
if space
1447-
.largest_acked_packet
1448-
.map_or(true, |pn| ack.largest > pn)
1449-
{
1442+
if space.largest_acked_packet.is_none_or(|pn| ack.largest > pn) {
14501443
space.largest_acked_packet = Some(ack.largest);
14511444
if let Some(info) = space.sent_packets.get(&ack.largest) {
14521445
// This should always succeed, but a misbehaving peer might ACK a packet we
@@ -1890,7 +1883,7 @@ impl Connection {
18901883
continue;
18911884
};
18921885
let pto = last_ack_eliciting + duration;
1893-
if result.map_or(true, |(earliest_pto, _)| pto < earliest_pto) {
1886+
if result.is_none_or(|(earliest_pto, _)| pto < earliest_pto) {
18941887
result = Some((pto, space));
18951888
}
18961889
}
@@ -3672,7 +3665,7 @@ impl Connection {
36723665
.filter(|&&t| !matches!(t, Timer::KeepAlive | Timer::PushNewCid | Timer::KeyDiscard))
36733666
.filter_map(|&t| Some((t, self.timers.get(t)?)))
36743667
.min_by_key(|&(_, time)| time)
3675-
.map_or(true, |(timer, _)| timer == Timer::Idle)
3668+
.is_none_or(|(timer, _)| timer == Timer::Idle)
36763669
}
36773670

36783671
/// Whether explicit congestion notification is in use on outgoing packets.

quinn-proto/src/connection/packet_crypto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub(super) fn decrypt_packet_body(
9090
&spaces[space].crypto.as_ref().unwrap().packet.remote
9191
} else if let Some(prev) = prev_crypto.and_then(|crypto| {
9292
// If this packet comes prior to acknowledgment of the key update by the peer,
93-
if crypto.end_packet.map_or(true, |(pn, _)| number < pn) {
93+
if crypto.end_packet.is_none_or(|(pn, _)| number < pn) {
9494
// use the previous keys.
9595
Some(crypto)
9696
} else {

quinn-proto/src/connection/paths.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,7 @@ impl RttEstimator {
338338
} else {
339339
self.latest
340340
};
341-
let var_sample = if smoothed > adjusted_rtt {
342-
smoothed - adjusted_rtt
343-
} else {
344-
adjusted_rtt - smoothed
345-
};
341+
let var_sample = smoothed.abs_diff(adjusted_rtt);
346342
self.var = (3 * self.var + var_sample) / 4;
347343
self.smoothed = Some((7 * smoothed + adjusted_rtt) / 8);
348344
} else {

quinn-proto/src/connection/spaces.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ impl PendingAcks {
775775
pub(super) fn insert_one(&mut self, packet: u64, now: Instant) {
776776
self.ranges.insert_one(packet);
777777

778-
if self.largest_packet.map_or(true, |(pn, _)| packet > pn) {
778+
if self.largest_packet.is_none_or(|(pn, _)| packet > pn) {
779779
self.largest_packet = Some((packet, now));
780780
}
781781

0 commit comments

Comments
 (0)