Skip to content

Commit 132ec0a

Browse files
committed
Fix clippy::useless_transmute
1 parent 8b6aef9 commit 132ec0a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/cli/self_update.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,6 @@ fn do_pre_install_options_sanity_checks(opts: &InstallOpts) -> Result<()> {
442442
fn do_anti_sudo_check(no_prompt: bool) -> Result<()> {
443443
#[cfg(unix)]
444444
pub fn home_mismatch() -> bool {
445-
use libc as c;
446-
447445
use std::env;
448446
use std::ffi::CStr;
449447
use std::mem;
@@ -460,13 +458,13 @@ fn do_anti_sudo_check(no_prompt: bool) -> Result<()> {
460458
return false;
461459
}
462460
let mut buf = [0u8; 1024];
463-
let mut pwd = unsafe { mem::uninitialized::<c::passwd>() };
464-
let mut pwdp: *mut c::passwd = ptr::null_mut();
461+
let mut pwd = unsafe { mem::uninitialized::<libc::passwd>() };
462+
let mut pwdp: *mut libc::passwd = ptr::null_mut();
465463
let rv = unsafe {
466-
c::getpwuid_r(
467-
c::geteuid(),
464+
libc::getpwuid_r(
465+
libc::geteuid(),
468466
&mut pwd,
469-
mem::transmute(&mut buf),
467+
&mut buf as *mut [u8] as *mut i8,
470468
buf.len(),
471469
&mut pwdp,
472470
)

0 commit comments

Comments
 (0)