diff options
author | Quang Luong <quangio@outlook.com> | 2020-09-18 11:20:06 +0700 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2020-10-08 10:19:51 +0200 |
commit | 9b53a9d1a61115a328ca43955153d09cc2e969ef (patch) | |
tree | b84d83a431dfdc5777e61d40c60c7b0de088f8fd /src/platform/linux/tun.rs | |
parent | Added MIT license (diff) | |
download | wireguard-rs-9b53a9d1a61115a328ca43955153d09cc2e969ef.tar.xz wireguard-rs-9b53a9d1a61115a328ca43955153d09cc2e969ef.zip |
Fix some clippy warnings
Signed-off-by: Quang Luong <quangio@outlook.com>
Diffstat (limited to '')
-rw-r--r-- | src/platform/linux/tun.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/platform/linux/tun.rs b/src/platform/linux/tun.rs index 15ca1ec..9157b38 100644 --- a/src/platform/linux/tun.rs +++ b/src/platform/linux/tun.rs @@ -1,7 +1,5 @@ use super::super::tun::*; -use libc; - use std::error::Error; use std::fmt; use std::mem; @@ -9,7 +7,7 @@ use std::os::raw::c_short; use std::os::unix::io::RawFd; const TUNSETIFF: u64 = 0x4004_54ca; -const CLONE_DEVICE_PATH: &'static [u8] = b"/dev/net/tun\0"; +const CLONE_DEVICE_PATH: &[u8] = b"/dev/net/tun\0"; #[repr(C)] struct Ifreq { @@ -75,11 +73,11 @@ impl fmt::Display for LinuxTunError { } impl Error for LinuxTunError { - fn description(&self) -> &str { + fn source(&self) -> Option<&(dyn Error + 'static)> { unimplemented!() } - fn source(&self) -> Option<&(dyn Error + 'static)> { + fn description(&self) -> &str { unimplemented!() } } @@ -156,7 +154,7 @@ fn get_mtu(name: &[u8; libc::IFNAMSIZ]) -> Result<usize, LinuxTunError> { mtu: 0, }; let err = unsafe { - let ptr: &libc::c_void = mem::transmute(&buf); + let ptr: &libc::c_void = &*(&buf as *const _ as *const libc::c_void); libc::ioctl(fd, libc::SIOCGIFMTU, ptr) }; @@ -312,9 +310,9 @@ impl LinuxTunStatus { } impl Tun for LinuxTun { - type Error = LinuxTunError; - type Reader = LinuxTunReader; type Writer = LinuxTunWriter; + type Reader = LinuxTunReader; + type Error = LinuxTunError; } impl PlatformTun for LinuxTun { |