Use match instead of a couple if let branches
This commit is contained in:
parent
874245bc2e
commit
26b773c643
1 changed files with 6 additions and 10 deletions
16
src/main.rs
16
src/main.rs
|
|
@ -631,26 +631,22 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Msg> {
|
fn subscription(&self) -> Subscription<Msg> {
|
||||||
let events = iced::event::listen_with(|evt, _, _| {
|
let events = iced::event::listen_with(|evt, _, _| match evt {
|
||||||
if let iced::Event::PlatformSpecific(iced::event::PlatformSpecific::Wayland(evt)) = evt
|
iced::Event::PlatformSpecific(iced::event::PlatformSpecific::Wayland(evt)) => {
|
||||||
{
|
|
||||||
if !matches!(evt, WaylandEvent::RequestResize) {
|
if !matches!(evt, WaylandEvent::RequestResize) {
|
||||||
Some(Msg::WaylandEvent(evt))
|
Some(Msg::WaylandEvent(evt))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
} else if let iced::Event::Keyboard(iced::keyboard::Event::KeyReleased {
|
}
|
||||||
|
iced::Event::Keyboard(iced::keyboard::Event::KeyReleased {
|
||||||
key: Key::Named(Named::Escape),
|
key: Key::Named(Named::Escape),
|
||||||
modifiers: _,
|
modifiers: _,
|
||||||
location: _,
|
location: _,
|
||||||
modified_key: _,
|
modified_key: _,
|
||||||
physical_key: _,
|
physical_key: _,
|
||||||
}) = evt
|
}) => Some(Msg::Close),
|
||||||
{
|
_ => None,
|
||||||
Some(Msg::Close)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
let config_subscription = cosmic_config::config_subscription::<_, CosmicWorkspacesConfig>(
|
let config_subscription = cosmic_config::config_subscription::<_, CosmicWorkspacesConfig>(
|
||||||
"config-sub",
|
"config-sub",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue