Skip to content

Commit

Permalink
Merge pull request #135 from expressvpn/rust-1.83
Browse files Browse the repository at this point in the history
Fix new lints in Rust 1.83
  • Loading branch information
xv-ian-c authored Dec 3, 2024
2 parents 84bde23 + 3aa391e commit 056b535
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lightway-core/src/borrowed_bytesmut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<'a> BorrowedBytesMut<'a> {
/// `bytes::Buf` trait for `BorrowedBytesMut`
/// These are the only required methods. All get_* helpers are provided
/// from the trait
impl<'a> Buf for BorrowedBytesMut<'a> {
impl Buf for BorrowedBytesMut<'_> {
fn remaining(&self) -> usize {
self.len()
}
Expand All @@ -103,7 +103,7 @@ impl<'a> Buf for BorrowedBytesMut<'a> {
}
}

impl<'a> Deref for BorrowedBytesMut<'a> {
impl Deref for BorrowedBytesMut<'_> {
type Target = [u8];

fn deref(&self) -> &Self::Target {
Expand Down
2 changes: 1 addition & 1 deletion lightway-core/src/connection/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,6 @@ impl<'a, AppState: Send + 'static> ServerConnectionBuilder<'a, AppState> {
}
}

impl<'a, AppState> BuilderPredicates for ServerConnectionBuilder<'a, AppState> {
impl<AppState> BuilderPredicates for ServerConnectionBuilder<'_, AppState> {
type Error = ConnectionBuilderError;
}
1 change: 0 additions & 1 deletion lightway-core/src/connection/dplpmtud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const PMTU_RAISE_TIMER_TIMEOUT: Duration = Duration::from_secs(600);
///
/// Here the "Packetization Layer" is "Lightway" itself (not
/// including DTLS or lower layers)
fn probe_payload_size_for_plpmtu(plpmtu: u16) -> u16 {
let overhead = std::mem::size_of::<wire::FrameKind>() + wire::Ping::WIRE_OVERHEAD;
debug_assert_ge!(plpmtu, overhead as u16);
Expand Down
4 changes: 2 additions & 2 deletions lightway-core/src/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ pub(crate) enum Frame<'data> {
DataFrag(data_frag::DataFrag),
}

impl<'data> Frame<'data> {
impl Frame<'_> {
pub(crate) fn kind(&self) -> FrameKind {
match self {
Self::NoOp => FrameKind::NoOp,
Expand Down Expand Up @@ -567,7 +567,7 @@ mod test_frame {
#[test_case(&[0x0c] => Frame::Goodbye; "goodbye")]
#[test_case(b"\x0e\x00\x0dserver config" => Frame::ServerConfig(ServerConfig{ data: Bytes::from_static(b"server config")}); "server config")]
#[test_case(b"\x0f\x00\x0b\x12\x34\x2a\xcffragmentary"=> Frame::DataFrag(DataFrag{ id: 0x1234, offset: 0x5678, more_fragments: true, data: Bytes::from_static(b"fragmentary") }) ; "data frag")]
fn try_from_wire(buf: &'static [u8]) -> Frame {
fn try_from_wire(buf: &'static [u8]) -> Frame<'static> {
let mut buf = BytesMut::from(buf);
let r = Frame::try_from_wire(&mut buf).unwrap();
assert!(buf.is_empty(), "Should consume entire frame");
Expand Down
2 changes: 1 addition & 1 deletion lightway-core/src/wire/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) struct Data<'data> {
pub(crate) data: Cow<'data, BytesMut>,
}

impl<'data> Data<'data> {
impl Data<'_> {
/// Wire overhead in bytes
const WIRE_OVERHEAD: usize = 2;

Expand Down
2 changes: 1 addition & 1 deletion lightway-server/src/connection_manager/connection_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub(crate) struct VacantEntry<'a, T> {
session_id_map: &'a mut HashMap<SessionId, Arc<T>>,
}

impl<'a, T: Value> VacantEntry<'a, T> {
impl<T: Value> VacantEntry<'_, T> {
pub(crate) fn insert(self, value: &Arc<T>) -> Result<(), InsertError> {
if self.socket_addr_entry.key() != &value.socket_addr() {
return Err(InsertError::InconsistentSocketAddr);
Expand Down
4 changes: 2 additions & 2 deletions lightway-server/src/io/outside/udp/cmsg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub enum Message<'a> {
Unknown(#[allow(dead_code)] &'a libc::cmsghdr),
}

impl<'a> Message<'a> {
impl Message<'_> {
pub(crate) const fn space<T>() -> usize {
// SAFETY: CMSG_SPACE is always safe
unsafe { libc::CMSG_SPACE(std::mem::size_of::<T>() as libc::c_uint) as usize }
Expand Down Expand Up @@ -154,7 +154,7 @@ pub(crate) struct BufferBuilder<'a, const N: usize> {
_phantom: std::marker::PhantomData<&'a mut Buffer<N>>,
}

impl<'a, const N: usize> BufferBuilder<'a, N> {
impl<const N: usize> BufferBuilder<'_, N> {
pub(crate) fn fill_next<T>(
&mut self,
cmsg_level: libc::c_int,
Expand Down

0 comments on commit 056b535

Please sign in to comment.