diff --git a/cosmic-applet-bluetooth/src/app.rs b/cosmic-applet-bluetooth/src/app.rs index b506c86b..efbc9b94 100644 --- a/cosmic-applet-bluetooth/src/app.rs +++ b/cosmic-applet-bluetooth/src/app.rs @@ -219,31 +219,34 @@ impl cosmic::Application for CosmicBluetoothApplet { } } BluerRequest::ConnectDevice(add) => { - self.bluer_state + if let Some(d) = self + .bluer_state .devices .iter_mut() .find(|d| d.address == *add) - .map(|d| { - d.status = BluerDeviceStatus::Connecting; - }); + { + d.status = BluerDeviceStatus::Connecting; + } } BluerRequest::DisconnectDevice(add) => { - self.bluer_state + if let Some(d) = self + .bluer_state .devices .iter_mut() .find(|d| d.address == *add) - .map(|d| { - d.status = BluerDeviceStatus::Disconnecting; - }); + { + d.status = BluerDeviceStatus::Disconnecting; + } } BluerRequest::PairDevice(add) => { - self.bluer_state + if let Some(d) = self + .bluer_state .devices .iter_mut() .find(|d| d.address == *add) - .map(|d| { - d.status = BluerDeviceStatus::Pairing; - }); + { + d.status = BluerDeviceStatus::Pairing; + } } _ => {} // TODO } diff --git a/cosmic-applet-network/src/app.rs b/cosmic-applet-network/src/app.rs index a455431c..27d4fa24 100644 --- a/cosmic-applet-network/src/app.rs +++ b/cosmic-applet-network/src/app.rs @@ -358,13 +358,14 @@ impl cosmic::Application for CosmicNetworkApplet { } Message::ActivateKnownWifi(ssid) => { let tx = if let Some(tx) = self.nm_sender.as_ref() { - self.nm_state + if let Some(ap) = self + .nm_state .known_access_points .iter_mut() .find(|c| c.ssid == ssid) - .map(|ap| { - ap.working = true; - }); + { + ap.working = true; + } tx } else { return Command::none(); @@ -376,16 +377,19 @@ impl cosmic::Application for CosmicNetworkApplet { } Message::Disconnect(ssid) => { let tx = if let Some(tx) = self.nm_sender.as_ref() { - self.nm_state + if let Some(ap) = self + .nm_state .active_conns .iter_mut() .find(|c| c.name() == ssid) - .map(|ap| match ap { + { + match ap { ActiveConnectionInfo::WiFi { state, .. } => { *state = ActiveConnectionState::Deactivating; } _ => {} - }); + } + } tx } else { return Command::none();