collapse nested 'match' statement

This commit is contained in:
daniel.eades 2023-11-16 18:11:19 +00:00 committed by Ashley Wulber
parent 6f48241613
commit 4db31e32e3

View file

@ -373,15 +373,13 @@ impl cosmic::Application for CosmicNetworkApplet {
}
Message::Disconnect(ssid) => {
let tx = if let Some(tx) = self.nm_sender.as_ref() {
if let Some(ap) = self
if let Some(ActiveConnectionInfo::WiFi { state, .. }) = self
.nm_state
.active_conns
.iter_mut()
.find(|c| c.name() == ssid)
{
if let ActiveConnectionInfo::WiFi { state, .. } = ap {
*state = ActiveConnectionState::Deactivating;
}
*state = ActiveConnectionState::Deactivating;
}
tx
} else {