Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit c600026

Browse files
committed
Merge pull request #202 from Gustorn/fixes
Small fixes
2 parents 8934fbf + 7b82068 commit c600026

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/input.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,19 @@ pub struct Key {
100100
pub ctrl: bool,
101101
}
102102

103-
impl Into<Key> for ffi::TCOD_key_t {
104-
fn into(self) -> Key {
103+
impl From<ffi::TCOD_key_t> for Key {
104+
fn from(tcod_key: ffi::TCOD_key_t) -> Key {
105105
Key {
106-
code: keycode_from_u32(self.vk).unwrap(),
107-
printable: self.c as u8 as char,
108-
pressed: self.pressed != 0,
109-
left_alt: self.lalt != 0,
110-
left_ctrl: self.lctrl != 0,
111-
right_alt: self.ralt != 0,
112-
right_ctrl: self.rctrl != 0,
113-
shift: self.shift != 0,
114-
alt: self.lalt != 0 || self.ralt != 0,
115-
ctrl: self.lctrl != 0 || self.rctrl != 0,
106+
code: keycode_from_u32(tcod_key.vk).unwrap(),
107+
printable: tcod_key.c as u8 as char,
108+
pressed: tcod_key.pressed != 0,
109+
left_alt: tcod_key.lalt != 0,
110+
left_ctrl: tcod_key.lctrl != 0,
111+
right_alt: tcod_key.ralt != 0,
112+
right_ctrl: tcod_key.rctrl != 0,
113+
shift: tcod_key.shift != 0,
114+
alt: tcod_key.lalt != 0 || tcod_key.ralt != 0,
115+
ctrl: tcod_key.lctrl != 0 || tcod_key.rctrl != 0,
116116
}
117117
}
118118
}

src/namegen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl Drop for Namegen {
2323
let _lock = NAMEGEN_MUTEX.lock()
2424
.ok()
2525
.expect("Namegen mutex could not be locked");
26-
if self.rng.len() > 0 {
26+
if self.rng.is_empty() {
2727
ffi::TCOD_namegen_destroy();
2828
}
2929
NAMEGEN_FREE = true;

0 commit comments

Comments
 (0)