Skip to content

Commit aa5b7d3

Browse files
committed
Clippy fixes
1 parent dd050e9 commit aa5b7d3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/key_handler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl KeyHandler {
4747
for (idx, is_down) in self.keys.iter().enumerate() {
4848
if *is_down {
4949
unsafe {
50-
keys.push(std::mem::transmute(idx as u8));
50+
keys.push(std::mem::transmute::<u8, Key>(idx as u8));
5151
}
5252
}
5353
}
@@ -85,7 +85,7 @@ impl KeyHandler {
8585
for (idx, is_down) in self.keys.iter().enumerate() {
8686
if *is_down && self.is_key_index_pressed(idx, repeat) {
8787
unsafe {
88-
keys.push(std::mem::transmute(idx as u8));
88+
keys.push(std::mem::transmute::<u8, Key>(idx as u8));
8989
}
9090
}
9191
}
@@ -99,7 +99,7 @@ impl KeyHandler {
9999
for (idx, is_down) in self.keys.iter().enumerate() {
100100
if !(*is_down) && self.is_key_index_released(idx) {
101101
unsafe {
102-
keys.push(std::mem::transmute(idx as u8));
102+
keys.push(std::mem::transmute::<u8, Key>(idx as u8));
103103
}
104104
}
105105
}

src/os/posix/wayland.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl DisplayInfo {
276276

277277
// Give the buffer to the surface and commit
278278
surface.attach(Some(buffer), 0, 0);
279-
surface.damage(0, 0, i32::max_value(), i32::max_value());
279+
surface.damage(0, 0, i32::MAX, i32::MAX);
280280
surface.commit();
281281

282282
let xdg_config = Rc::new(RefCell::new(None));
@@ -350,7 +350,7 @@ impl DisplayInfo {
350350
let slice = unsafe {
351351
std::slice::from_raw_parts(
352352
buffer.as_ptr() as *const u8,
353-
buffer.len() * std::mem::size_of::<u32>(),
353+
std::mem::size_of_val(buffer),
354354
)
355355
};
356356

@@ -364,7 +364,7 @@ impl DisplayInfo {
364364

365365
self.surface.attach(Some(buf), 0, 0);
366366
self.surface
367-
.damage(0, 0, i32::max_value(), i32::max_value());
367+
.damage(0, 0, i32::MAX, i32::MAX);
368368
self.surface.commit();
369369

370370
Ok(())

src/os/posix/x11.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ impl Window {
12001200
}
12011201

12021202
fn update_key_state(&mut self, sym: xlib::KeySym, is_down: bool) {
1203-
if sym > u32::max_value() as xlib::KeySym {
1203+
if sym > u32::MAX as xlib::KeySym {
12041204
return;
12051205
}
12061206

0 commit comments

Comments
 (0)