Skip to content

Commit

Permalink
add type annotations to std::mem::transmute calls
Browse files Browse the repository at this point in the history
  • Loading branch information
JanNeuenfeld committed Aug 24, 2024
1 parent e49f4a0 commit 5f65f17
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/key_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use instant::{Duration, Instant};
#[cfg(not(feature = "web"))]
use std::time::{Duration, Instant};

use crate::{InputCallback, Key, KeyRepeat};
use crate::{key, InputCallback, Key, KeyRepeat};

pub struct KeyHandler {
pub key_callback: Option<Box<dyn InputCallback>>,
Expand Down Expand Up @@ -47,7 +47,7 @@ impl KeyHandler {
for (idx, is_down) in self.keys.iter().enumerate() {
if *is_down {
unsafe {
keys.push(std::mem::transmute(idx as u8));
keys.push(std::mem::transmute::<u8, key::Key>(idx as u8));
}
}
}
Expand Down Expand Up @@ -85,7 +85,7 @@ impl KeyHandler {
for (idx, is_down) in self.keys.iter().enumerate() {
if *is_down && self.is_key_index_pressed(idx, repeat) {
unsafe {
keys.push(std::mem::transmute(idx as u8));
keys.push(std::mem::transmute::<u8, key::Key>(idx as u8));
}
}
}
Expand All @@ -99,7 +99,7 @@ impl KeyHandler {
for (idx, is_down) in self.keys.iter().enumerate() {
if !(*is_down) && self.is_key_index_released(idx) {
unsafe {
keys.push(std::mem::transmute(idx as u8));
keys.push(std::mem::transmute::<u8, key::Key>(idx as u8));
}
}
}
Expand Down

0 comments on commit 5f65f17

Please sign in to comment.