summaryrefslogtreecommitdiffstats
path: root/third_party/rust/neqo-transport/src/frame.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/neqo-transport/src/frame.rs')
-rw-r--r--third_party/rust/neqo-transport/src/frame.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/third_party/rust/neqo-transport/src/frame.rs b/third_party/rust/neqo-transport/src/frame.rs
index f3d567ac7c..b3bb024a2c 100644
--- a/third_party/rust/neqo-transport/src/frame.rs
+++ b/third_party/rust/neqo-transport/src/frame.rs
@@ -6,7 +6,7 @@
// Directly relating to QUIC frames.
-use std::{convert::TryFrom, ops::RangeInclusive};
+use std::ops::RangeInclusive;
use neqo_common::{qtrace, Decoder};
@@ -78,6 +78,7 @@ impl CloseError {
}
}
+ #[must_use]
pub fn code(&self) -> u64 {
match self {
Self::Transport(c) | Self::Application(c) => *c,
@@ -303,7 +304,7 @@ impl<'a> Frame<'a> {
)
}
- /// Converts AckRanges as encoded in a ACK frame (see -transport
+ /// Converts `AckRanges` as encoded in a ACK frame (see -transport
/// 19.3.1) into ranges of acked packets (end, start), inclusive of
/// start and end values.
pub fn decode_ack_frame(
@@ -387,6 +388,7 @@ impl<'a> Frame<'a> {
}
}
+ #[allow(clippy::too_many_lines)] // Yeah, but it's a nice match statement.
pub fn decode(dec: &mut Decoder<'a>) -> Res<Self> {
/// Maximum ACK Range Count in ACK Frame
///
@@ -430,7 +432,7 @@ impl<'a> Frame<'a> {
}
})?;
let fa = dv(dec)?;
- let mut arr: Vec<AckRange> = Vec::with_capacity(nr as usize);
+ let mut arr: Vec<AckRange> = Vec::with_capacity(usize::try_from(nr)?);
for _ in 0..nr {
let ar = AckRange {
gap: dv(dec)?,
@@ -615,7 +617,11 @@ impl<'a> Frame<'a> {
mod tests {
use neqo_common::{Decoder, Encoder};
- use super::*;
+ use crate::{
+ cid::MAX_CONNECTION_ID_LEN,
+ frame::{AckRange, Frame, FRAME_TYPE_ACK},
+ CloseError, Error, StreamId, StreamType,
+ };
fn just_dec(f: &Frame, s: &str) {
let encoded = Encoder::from_hex(s);