refactor ~ remove unneeded mem::uninitialized() code
.# [why]
`mem::ununitialized()` is deprecated as of rust v1.39.0.
And this use is likely a premature optimization attempting to avoid
initializing the byte array to 0, which is usually a *very* fast operation.
* ref: <https://github.com/rust-lang/rust/blob/master/RELEASES.md>
* ref: <https://stackoverflow.com/questions/3654905/faster-way-to-zero-memory-than-with-memset>
@@ -14,8 +14,6 @@ extern crate uucore;
use std::fs::File;
use std::io::{self, stdin, BufReader, Read};
-#[cfg(not(windows))]
-use std::mem;
use std::path::Path;
include!(concat!(env!("OUT_DIR"), "/crc_table.rs"));
@@ -39,16 +37,10 @@ fn crc_final(mut crc: u32, mut length: usize) -> u32 {
!crc
}
-#[cfg(windows)]
fn init_byte_array() -> Vec<u8> {
vec![0; 1024 * 1024]
}
-#[cfg(not(windows))]
-fn init_byte_array() -> [u8; 1024 * 1024] {
- unsafe { mem::uninitialized() }
-}
-
#[inline]
fn cksum(fname: &str) -> io::Result<(u32, usize)> {
let mut crc = 0u32;
