Skip to content

Commit

Permalink
Move assignments out of unsafe blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
DataTriny committed Sep 22, 2024
1 parent d49149c commit 8bad9dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions platforms/windows/examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@ fn main() -> Result<()> {
println!("Enable Narrator with [Win]+[Ctrl]+[Enter] (or [Win]+[Enter] on older versions of Windows).");

let window = create_window(WINDOW_TITLE, INITIAL_FOCUS)?;
unsafe { _ = ShowWindow(window, SW_SHOW) };
let _ = unsafe { ShowWindow(window, SW_SHOW) };

let mut message = MSG::default();
while unsafe { GetMessageW(&mut message, HWND::default(), 0, 0) }.into() {
unsafe { _ = TranslateMessage(&message) };
let _ = unsafe { TranslateMessage(&message) };
unsafe { DispatchMessageW(&message) };
}

Expand Down
6 changes: 3 additions & 3 deletions platforms/windows/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ pub(crate) struct Scope {

impl Scope {
pub(crate) fn show_and_focus_window(&self) {
unsafe { _ = ShowWindow(self.window.0, SW_SHOW) };
unsafe { _ = SetForegroundWindow(self.window.0) };
let _ = unsafe { ShowWindow(self.window.0, SW_SHOW) };
let _ = unsafe { SetForegroundWindow(self.window.0) };
}
}

Expand Down Expand Up @@ -213,7 +213,7 @@ where

let mut message = MSG::default();
while unsafe { GetMessageW(&mut message, HWND::default(), 0, 0) }.into() {
unsafe { _ = TranslateMessage(&message) };
let _ = unsafe { TranslateMessage(&message) };
unsafe { DispatchMessageW(&message) };
}
});
Expand Down

0 comments on commit 8bad9dc

Please sign in to comment.