diff --git a/crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs b/crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs index b7782079f620..c852c9d68499 100644 --- a/crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs +++ b/crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs @@ -281,7 +281,7 @@ impl PacketFilter { let states_count = states.ps_len as usize / mem::size_of::(); for i in 0..states_count { - let state = &*(states.ps_u.psu_states.offset(i as isize)); + let state = &*(states.ps_u.psu_states.add(i)); if state.proto == libc::IPPROTO_UDP as u8 { cfg_if! { diff --git a/crates/shadowsocks-service/src/local/redir/sys/unix/mod.rs b/crates/shadowsocks-service/src/local/redir/sys/unix/mod.rs index 7a080386bca0..2c910bf870c6 100644 --- a/crates/shadowsocks-service/src/local/redir/sys/unix/mod.rs +++ b/crates/shadowsocks-service/src/local/redir/sys/unix/mod.rs @@ -13,12 +13,12 @@ cfg_if! { target_os = "ios"))] { #[path = "pfvar_bindgen_macos.rs"] #[allow(dead_code, non_upper_case_globals, non_snake_case, non_camel_case_types)] - #[allow(clippy::useless_transmute)] + #[allow(clippy::useless_transmute, clippy::too_many_arguments, clippy::unnecessary_cast)] mod pfvar; } else if #[cfg(target_os = "freebsd")] { #[path = "pfvar_bindgen_freebsd.rs"] #[allow(dead_code, non_upper_case_globals, non_snake_case, non_camel_case_types)] - #[allow(clippy::useless_transmute)] + #[allow(clippy::useless_transmute, clippy::too_many_arguments, clippy::unnecessary_cast)] mod pfvar; } } diff --git a/src/sys.rs b/src/sys.rs index dc9501eba3a4..df9316d9868c 100644 --- a/src/sys.rs +++ b/src/sys.rs @@ -120,7 +120,7 @@ pub fn run_as_user(uname: &str) -> std::io::Result<()> { return Err(err); } - if libc::initgroups(pwd.pw_name, pwd.pw_gid.try_into().unwrap()) != 0 { + if libc::initgroups(pwd.pw_name, pwd.pw_gid as _) != 0 { let err = Error::last_os_error(); error!( "could not change supplementary groups to user {:?}'s gid: {}, uid: {}, error: {}",