Remove window.id() match, simply nested matches with single if-let

This commit is contained in:
Marijn Suijten 2021-12-21 00:39:35 +01:00 committed by Benjamin Saunders
parent 5b53dd94cb
commit 9d36436a53

View file

@ -185,11 +185,8 @@ impl ExampleBase {
.run_return(|event, _, control_flow| { .run_return(|event, _, control_flow| {
*control_flow = ControlFlow::Wait; *control_flow = ControlFlow::Wait;
f(); f();
match event { if let Event::WindowEvent {
Event::WindowEvent { event:
ref event,
window_id,
} if window_id == self.window.id() => match event {
WindowEvent::CloseRequested WindowEvent::CloseRequested
| WindowEvent::KeyboardInput { | WindowEvent::KeyboardInput {
input: input:
@ -199,10 +196,11 @@ impl ExampleBase {
.. ..
}, },
.. ..
} => *control_flow = ControlFlow::Exit,
_ => {}
}, },
_ => {} ..
} = event
{
*control_flow = ControlFlow::Exit
} }
}); });
} }