diff --git a/quinn-proto/src/config.rs b/quinn-proto/src/config.rs index c51557a33..6d53fd590 100644 --- a/quinn-proto/src/config.rs +++ b/quinn-proto/src/config.rs @@ -630,8 +630,8 @@ pub struct EndpointConfig { impl EndpointConfig { /// Create a default config with a particular `reset_key` pub fn new(reset_key: Arc) -> Self { - let cid_factory: fn() -> Box = - || Box::::default(); + let cid_factory = + || -> Box { Box::::default() }; Self { reset_key, max_udp_payload_size: (1500u32 - 28).into(), // Ethernet MTU minus IP + UDP headers diff --git a/quinn-proto/src/packet.rs b/quinn-proto/src/packet.rs index 3e5bf0fd0..be132a74f 100644 --- a/quinn-proto/src/packet.rs +++ b/quinn-proto/src/packet.rs @@ -32,7 +32,7 @@ impl PartialDecode { /// Begin decoding a QUIC packet from `bytes`, returning any trailing data not part of that packet pub fn new( bytes: BytesMut, - cid_parser: &impl ConnectionIdParser, + cid_parser: &(impl ConnectionIdParser + ?Sized), supported_versions: &[u32], grease_quic_bit: bool, ) -> Result<(Self, Option), PacketDecodeError> { @@ -564,7 +564,7 @@ impl ProtectedHeader { /// Decode a plain header from given buffer, with given [`ConnectionIdParser`]. pub fn decode( buf: &mut io::Cursor, - cid_parser: &impl ConnectionIdParser, + cid_parser: &(impl ConnectionIdParser + ?Sized), supported_versions: &[u32], grease_quic_bit: bool, ) -> Result { @@ -780,7 +780,7 @@ impl FixedLengthConnectionIdParser { } impl ConnectionIdParser for FixedLengthConnectionIdParser { - fn parse(&self, buffer: &mut impl Buf) -> Result { + fn parse(&self, buffer: &mut dyn Buf) -> Result { (buffer.remaining() >= self.expected_len) .then(|| ConnectionId::from_buf(buffer, self.expected_len)) .ok_or(PacketDecodeError::InvalidHeader("packet too small")) @@ -790,7 +790,7 @@ impl ConnectionIdParser for FixedLengthConnectionIdParser { /// Parse connection id in short header packet pub trait ConnectionIdParser { /// Parse a connection id from given buffer - fn parse(&self, buf: &mut impl Buf) -> Result; + fn parse(&self, buf: &mut dyn Buf) -> Result; } /// Long packet type including non-uniform cases diff --git a/quinn-proto/src/shared.rs b/quinn-proto/src/shared.rs index d4e5029c7..05ffe8caf 100644 --- a/quinn-proto/src/shared.rs +++ b/quinn-proto/src/shared.rs @@ -86,7 +86,7 @@ impl ConnectionId { /// Constructs cid by reading `len` bytes from a `Buf` /// /// Callers need to assure that `buf.remaining() >= len` - pub fn from_buf(buf: &mut impl Buf, len: usize) -> Self { + pub fn from_buf(buf: &mut (impl Buf + ?Sized), len: usize) -> Self { debug_assert!(len <= MAX_CID_SIZE); let mut res = Self { len: len as u8,