Update to Rust 2021 Edition (#2114)

This commit is contained in:
Lucas Kent 2022-01-13 16:59:57 +11:00 committed by GitHub
parent a52f755ce8
commit cf4660841a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -3,7 +3,7 @@ name = "winit"
version = "0.26.1" version = "0.26.1"
authors = ["The winit contributors", "Pierre Krieger <pierre.krieger1708@gmail.com>"] authors = ["The winit contributors", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Cross-platform window creation library." description = "Cross-platform window creation library."
edition = "2018" edition = "2021"
keywords = ["windowing"] keywords = ["windowing"]
license = "Apache-2.0" license = "Apache-2.0"
readme = "README.md" readme = "README.md"

View file

@ -139,7 +139,10 @@ where
// However we want to keep that weak reference around after the function. // However we want to keep that weak reference around after the function.
std::mem::forget(info_from_raw); std::mem::forget(info_from_raw);
stop_app_on_panic(Weak::clone(&panic_info), move || f(panic_info.0)); stop_app_on_panic(Weak::clone(&panic_info), move || {
let _ = &panic_info;
f(panic_info.0)
});
} }
// begin is queued with the highest priority to ensure it is processed before other observers // begin is queued with the highest priority to ensure it is processed before other observers

View file

@ -90,6 +90,7 @@ impl Window {
let window = self.window.clone(); let window = self.window.clone();
let window_state = Arc::clone(&self.window_state); let window_state = Arc::clone(&self.window_state);
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
WindowState::set_window_flags(window_state.lock(), window.0, |f| { WindowState::set_window_flags(window_state.lock(), window.0, |f| {
f.set(WindowFlags::VISIBLE, visible) f.set(WindowFlags::VISIBLE, visible)
}); });
@ -131,6 +132,7 @@ impl Window {
let window_state = Arc::clone(&self.window_state); let window_state = Arc::clone(&self.window_state);
let window = self.window.clone(); let window = self.window.clone();
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
WindowState::set_window_flags(window_state.lock(), window.0, |f| { WindowState::set_window_flags(window_state.lock(), window.0, |f| {
f.set(WindowFlags::MAXIMIZED, false) f.set(WindowFlags::MAXIMIZED, false)
}); });
@ -185,6 +187,7 @@ impl Window {
let window_state = Arc::clone(&self.window_state); let window_state = Arc::clone(&self.window_state);
let window = self.window.clone(); let window = self.window.clone();
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
WindowState::set_window_flags(window_state.lock(), window.0, |f| { WindowState::set_window_flags(window_state.lock(), window.0, |f| {
f.set(WindowFlags::MAXIMIZED, false) f.set(WindowFlags::MAXIMIZED, false)
}); });
@ -215,6 +218,7 @@ impl Window {
let window_state = Arc::clone(&self.window_state); let window_state = Arc::clone(&self.window_state);
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
WindowState::set_window_flags(window_state.lock(), window.0, |f| { WindowState::set_window_flags(window_state.lock(), window.0, |f| {
f.set(WindowFlags::RESIZABLE, resizable) f.set(WindowFlags::RESIZABLE, resizable)
}); });
@ -256,6 +260,7 @@ impl Window {
let (tx, rx) = channel(); let (tx, rx) = channel();
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
let result = window_state let result = window_state
.lock() .lock()
.mouse .mouse
@ -273,6 +278,7 @@ impl Window {
let (tx, rx) = channel(); let (tx, rx) = channel();
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
let result = window_state let result = window_state
.lock() .lock()
.mouse .mouse
@ -340,6 +346,7 @@ impl Window {
let window_state = Arc::clone(&self.window_state); let window_state = Arc::clone(&self.window_state);
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
WindowState::set_window_flags(window_state.lock(), window.0, |f| { WindowState::set_window_flags(window_state.lock(), window.0, |f| {
f.set(WindowFlags::MINIMIZED, minimized) f.set(WindowFlags::MINIMIZED, minimized)
}); });
@ -352,6 +359,7 @@ impl Window {
let window_state = Arc::clone(&self.window_state); let window_state = Arc::clone(&self.window_state);
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
WindowState::set_window_flags(window_state.lock(), window.0, |f| { WindowState::set_window_flags(window_state.lock(), window.0, |f| {
f.set(WindowFlags::MAXIMIZED, maximized) f.set(WindowFlags::MAXIMIZED, maximized)
}); });
@ -384,6 +392,7 @@ impl Window {
drop(window_state_lock); drop(window_state_lock);
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
// Change video mode if we're transitioning to or from exclusive // Change video mode if we're transitioning to or from exclusive
// fullscreen // fullscreen
match (&old_fullscreen, &fullscreen) { match (&old_fullscreen, &fullscreen) {
@ -528,6 +537,7 @@ impl Window {
let window_state = Arc::clone(&self.window_state); let window_state = Arc::clone(&self.window_state);
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
WindowState::set_window_flags(window_state.lock(), window.0, |f| { WindowState::set_window_flags(window_state.lock(), window.0, |f| {
f.set(WindowFlags::DECORATIONS, decorations) f.set(WindowFlags::DECORATIONS, decorations)
}); });
@ -540,6 +550,7 @@ impl Window {
let window_state = Arc::clone(&self.window_state); let window_state = Arc::clone(&self.window_state);
self.thread_executor.execute_in_thread(move || { self.thread_executor.execute_in_thread(move || {
let _ = &window;
WindowState::set_window_flags(window_state.lock(), window.0, |f| { WindowState::set_window_flags(window_state.lock(), window.0, |f| {
f.set(WindowFlags::ALWAYS_ON_TOP, always_on_top) f.set(WindowFlags::ALWAYS_ON_TOP, always_on_top)
}); });
@ -612,6 +623,7 @@ impl Window {
} }
self.thread_executor.execute_in_thread(move || unsafe { self.thread_executor.execute_in_thread(move || unsafe {
let _ = &window;
let (flags, count) = request_type let (flags, count) = request_type
.map(|ty| match ty { .map(|ty| match ty {
UserAttentionType::Critical => { UserAttentionType::Critical => {