From a574d86e779a5cf4230631ad8888736c344f4cc4 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 10 Nov 2021 00:16:16 +0100 Subject: remove gratuitous use of unsafe --- src/vtcol.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/vtcol.rs b/src/vtcol.rs index 665b600..c3344ce 100644 --- a/src/vtcol.rs +++ b/src/vtcol.rs @@ -358,7 +358,7 @@ impl Palette pub fn new(colors: &[&str; PALETTE_SIZE]) -> Palette { let mut idx: usize = 0_usize; - let mut pal: [u8; PALETTE_BYTES] = unsafe { std::mem::zeroed() }; + let mut pal: [u8; PALETTE_BYTES] = [0; PALETTE_BYTES]; for def in colors.iter() { let (r, g, b) = rgb_of_hex_triplet(*def); @@ -381,7 +381,7 @@ impl Palette pub fn from_buffered_reader(reader: &mut std::io::BufRead) -> Palette { let mut pal_idx: usize = 0_usize; - let mut pal: [u8; PALETTE_BYTES] = unsafe { std::mem::zeroed() }; + let mut pal: [u8; PALETTE_BYTES] = [0; PALETTE_BYTES]; let mut line: String = String::new(); while reader.read_line(&mut line).is_ok() { -- cgit v1.2.3