diff --git a/src/cp/cp.rs b/src/cp/cp.rs index 1ef32697e..796b5c4b2 100644 --- a/src/cp/cp.rs +++ b/src/cp/cp.rs @@ -739,6 +739,7 @@ fn preserve_hardlinks( #[cfg(windows)] { let src_path: Vec = OsStr::new(source).encode_wide().collect(); + #[allow(deprecated)] let stat = mem::uninitialized(); let handle = CreateFileW( src_path.as_ptr(), diff --git a/src/hostname/hostname.rs b/src/hostname/hostname.rs index 82e5504dc..7c79af072 100644 --- a/src/hostname/hostname.rs +++ b/src/hostname/hostname.rs @@ -46,6 +46,7 @@ pub fn uumain(args: Vec) -> i32 { #![allow(clippy::let_and_return)] #[cfg(windows)] unsafe { + #[allow(deprecated)] let mut data = std::mem::uninitialized(); if WSAStartup(MAKEWORD(2, 2), &mut data as *mut _) != 0 { eprintln!("Failed to start Winsock 2.2"); diff --git a/src/id/id.rs b/src/id/id.rs index aface17fc..5076f748b 100644 --- a/src/id/id.rs +++ b/src/id/id.rs @@ -30,7 +30,6 @@ macro_rules! cstr2cow { #[cfg(not(target_os = "linux"))] mod audit { - pub use std::mem::uninitialized; use super::libc::{c_int, c_uint, dev_t, pid_t, uid_t, uint64_t}; pub type au_id_t = uid_t; @@ -278,7 +277,8 @@ fn auditid() {} #[cfg(not(target_os = "linux"))] fn auditid() { - let mut auditinfo: audit::c_auditinfo_addr_t = unsafe { audit::uninitialized() }; + #[allow(deprecated)] + let mut auditinfo: audit::c_auditinfo_addr_t = unsafe { std::mem::uninitialized() }; let address = &mut auditinfo as *mut audit::c_auditinfo_addr_t; if unsafe { audit::getaudit(address) } < 0 { println!("couldn't retrieve information"); diff --git a/src/sync/sync.rs b/src/sync/sync.rs index 9b66940aa..a6d7faaba 100644 --- a/src/sync/sync.rs +++ b/src/sync/sync.rs @@ -72,6 +72,7 @@ mod platform { } unsafe fn find_first_volume() -> (String, winnt::HANDLE) { + #[allow(deprecated)] let mut name: [winnt::WCHAR; minwindef::MAX_PATH] = mem::uninitialized(); let handle = kernel32::FindFirstVolumeW(name.as_mut_ptr(), name.len() as minwindef::DWORD); if handle == handleapi::INVALID_HANDLE_VALUE { @@ -87,6 +88,7 @@ mod platform { let (first_volume, next_volume_handle) = find_first_volume(); let mut volumes = vec![first_volume]; loop { + #[allow(deprecated)] let mut name: [winnt::WCHAR; minwindef::MAX_PATH] = mem::uninitialized(); if kernel32::FindNextVolumeW( next_volume_handle, diff --git a/src/unlink/unlink.rs b/src/unlink/unlink.rs index f5fc9f4f5..8c472824b 100644 --- a/src/unlink/unlink.rs +++ b/src/unlink/unlink.rs @@ -21,7 +21,6 @@ use getopts::Options; use libc::{S_IFLNK, S_IFMT, S_IFREG}; use libc::{lstat, stat, unlink}; use std::io::{Error, ErrorKind}; -use std::mem::uninitialized; use std::ffi::CString; static NAME: &str = "unlink"; @@ -71,7 +70,8 @@ pub fn uumain(args: Vec) -> i32 { let c_string = CString::new(matches.free[0].clone()).unwrap(); // unwrap() cannot fail, the string comes from argv so it cannot contain a \0. let st_mode = { - let mut buf: stat = unsafe { uninitialized() }; + #[allow(deprecated)] + let mut buf: stat = unsafe { std::mem::uninitialized() }; let result = unsafe { lstat( c_string.as_ptr(), diff --git a/src/whoami/platform/windows.rs b/src/whoami/platform/windows.rs index b321b93be..d08937a65 100644 --- a/src/whoami/platform/windows.rs +++ b/src/whoami/platform/windows.rs @@ -19,6 +19,7 @@ use self::winapi::shared::lmcons; use self::winapi::shared::minwindef; pub unsafe fn getusername() -> Result { + #[allow(deprecated)] let mut buffer: [winnt::WCHAR; lmcons::UNLEN as usize + 1] = mem::uninitialized(); let mut len = buffer.len() as minwindef::DWORD; if advapi32::GetUserNameW(buffer.as_mut_ptr(), &mut len) == 0 {