diff --git a/boringtun/Cargo.toml b/boringtun/Cargo.toml index a81e8701..23841b94 100644 --- a/boringtun/Cargo.toml +++ b/boringtun/Cargo.toml @@ -10,7 +10,7 @@ authors = [ license = "BSD-3-Clause" repository = "https://github.com/cloudflare/boringtun" documentation = "https://docs.rs/boringtun/0.5.2/boringtun/" -edition = "2018" +edition = "2021" [features] default = [] diff --git a/boringtun/src/device/dev_lock.rs b/boringtun/src/device/dev_lock.rs index 1a700fab..de94683a 100644 --- a/boringtun/src/device/dev_lock.rs +++ b/boringtun/src/device/dev_lock.rs @@ -45,7 +45,7 @@ pub struct LockReadGuard<'a, T: 'a + ?Sized> { inner: RwLockReadGuard<'a, T>, } -impl<'a, T: ?Sized> LockReadGuard<'a, T> { +impl LockReadGuard<'_, T> { /// Perform a closure on a mutable reference of the inner locked value. /// /// # Parameters @@ -99,7 +99,7 @@ impl<'a, T: ?Sized> LockReadGuard<'a, T> { } } -impl<'a, T: ?Sized> Deref for LockReadGuard<'a, T> { +impl Deref for LockReadGuard<'_, T> { type Target = T; fn deref(&self) -> &T { diff --git a/boringtun/src/device/epoll.rs b/boringtun/src/device/epoll.rs index 4cd810ed..c1687f9a 100644 --- a/boringtun/src/device/epoll.rs +++ b/boringtun/src/device/epoll.rs @@ -346,14 +346,14 @@ impl EventPoll { } } -impl<'a, H> Deref for EventGuard<'a, H> { +impl Deref for EventGuard<'_, H> { type Target = H; fn deref(&self) -> &H { &self.event.handler } } -impl<'a, H> Drop for EventGuard<'a, H> { +impl Drop for EventGuard<'_, H> { fn drop(&mut self) { if self.event.needs_read { // Must read from the event to reset it before we enable it @@ -373,7 +373,7 @@ impl<'a, H> Drop for EventGuard<'a, H> { } } -impl<'a, H> EventGuard<'a, H> { +impl EventGuard<'_, H> { /// Get a mutable reference to the stored value #[allow(dead_code)] pub fn get_mut(&mut self) -> &mut H { diff --git a/boringtun/src/device/kqueue.rs b/boringtun/src/device/kqueue.rs index 7b5f9d17..e9786486 100644 --- a/boringtun/src/device/kqueue.rs +++ b/boringtun/src/device/kqueue.rs @@ -309,14 +309,14 @@ impl EventPoll { } } -impl<'a, H> Deref for EventGuard<'a, H> { +impl Deref for EventGuard<'_, H> { type Target = H; fn deref(&self) -> &H { &self.event.handler } } -impl<'a, H> Drop for EventGuard<'a, H> { +impl Drop for EventGuard<'_, H> { fn drop(&mut self) { unsafe { // Re-enable the event once EventGuard goes out of scope @@ -325,7 +325,7 @@ impl<'a, H> Drop for EventGuard<'a, H> { } } -impl<'a, H> EventGuard<'a, H> { +impl EventGuard<'_, H> { /// Cancel and remove the event represented by this guard pub fn cancel(self) { unsafe { self.poll.clear_event_by_fd(self.event.event.ident as RawFd) }; diff --git a/boringtun/src/device/tun_linux.rs b/boringtun/src/device/tun_linux.rs index dee2999e..d4a0f564 100644 --- a/boringtun/src/device/tun_linux.rs +++ b/boringtun/src/device/tun_linux.rs @@ -31,6 +31,7 @@ union IfrIfru { } #[repr(C)] +#[allow(non_camel_case_types)] pub struct ifreq { ifr_name: [c_uchar; IFNAMSIZ], ifr_ifru: IfrIfru, @@ -72,7 +73,7 @@ impl TunSocket { }); } - let fd = match unsafe { open(b"/dev/net/tun\0".as_ptr() as _, O_RDWR) } { + let fd = match unsafe { open(c"/dev/net/tun".as_ptr() as _, O_RDWR) } { -1 => return Err(Error::Socket(io::Error::last_os_error())), fd => fd, };