From 9d36436a5371d06ee9463f00bd1fc2b71102a237 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Tue, 21 Dec 2021 00:39:35 +0100 Subject: [PATCH] Remove window.id() match, simply nested matches with single if-let --- examples/src/lib.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 314411b..b27d7bb 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -185,11 +185,8 @@ impl ExampleBase { .run_return(|event, _, control_flow| { *control_flow = ControlFlow::Wait; f(); - match event { - Event::WindowEvent { - ref event, - window_id, - } if window_id == self.window.id() => match event { + if let Event::WindowEvent { + event: WindowEvent::CloseRequested | WindowEvent::KeyboardInput { input: @@ -199,10 +196,11 @@ impl ExampleBase { .. }, .. - } => *control_flow = ControlFlow::Exit, - _ => {} - }, - _ => {} + }, + .. + } = event + { + *control_flow = ControlFlow::Exit } }); }