From 8bad9dc7f4560bcce9f6328108db9a98927fc80b Mon Sep 17 00:00:00 2001 From: Arnold Loubriat Date: Sun, 22 Sep 2024 23:00:56 +0200 Subject: [PATCH] Move assignments out of unsafe blocks --- platforms/windows/examples/hello_world.rs | 4 ++-- platforms/windows/src/tests/mod.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platforms/windows/examples/hello_world.rs b/platforms/windows/examples/hello_world.rs index c701f80e..c962ce85 100644 --- a/platforms/windows/examples/hello_world.rs +++ b/platforms/windows/examples/hello_world.rs @@ -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) }; } diff --git a/platforms/windows/src/tests/mod.rs b/platforms/windows/src/tests/mod.rs index f642d693..5eb5e309 100644 --- a/platforms/windows/src/tests/mod.rs +++ b/platforms/windows/src/tests/mod.rs @@ -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) }; } } @@ -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) }; } });