summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2021-11-10 00:16:16 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2021-11-10 01:20:11 +0100
commita574d86e779a5cf4230631ad8888736c344f4cc4 (patch)
treed997b6cc4eb9e6ff2b260cd3235fe2120c856c24
parent8c8334bc0e0c1b4129541fd1f556a701b131497b (diff)
downloadvtcol-a574d86e779a5cf4230631ad8888736c344f4cc4.tar.gz
remove gratuitous use of unsafe
-rw-r--r--src/vtcol.rs4
1 files changed, 2 insertions, 2 deletions
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() {