From a1a5ccf8fdbb454a4055d88d254026a4d91a71b1 Mon Sep 17 00:00:00 2001 From: Zhang Jingqiang Date: Thu, 16 May 2024 11:57:38 +0800 Subject: [PATCH] fix clippy warning on Windows --- lib/g3-compat/src/sched/os.rs | 8 +------- lib/g3-socket/src/raw/windows.rs | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/g3-compat/src/sched/os.rs b/lib/g3-compat/src/sched/os.rs index 5d63509c3..3d6344a11 100644 --- a/lib/g3-compat/src/sched/os.rs +++ b/lib/g3-compat/src/sched/os.rs @@ -16,15 +16,9 @@ use std::io; -#[derive(Clone)] +#[derive(Clone, Default)] pub struct CpuAffinity {} -impl Default for CpuAffinity { - fn default() -> Self { - CpuAffinity {} - } -} - impl CpuAffinity { pub fn add_id(&mut self, _id: usize) -> io::Result<()> { Err(io::Error::new( diff --git a/lib/g3-socket/src/raw/windows.rs b/lib/g3-socket/src/raw/windows.rs index a5d7c8ebf..8f2bb6b01 100644 --- a/lib/g3-socket/src/raw/windows.rs +++ b/lib/g3-socket/src/raw/windows.rs @@ -25,9 +25,9 @@ use super::RawSocket; impl RawSocket { pub fn sendmsg(&self, iov: &[IoSlice<'_>], target: Option) -> io::Result { let msg_hdr = MsgHdr::new().with_buffers(iov); - let target = target.map(|v| SockAddr::from(v)); + let target = target.map(SockAddr::from); let msg_hdr = if let Some(addr) = &target { - msg_hdr.with_addr(&addr) + msg_hdr.with_addr(addr) } else { msg_hdr };