avoid using 'map' and then returning '()'

This commit is contained in:
daniel.eades 2023-11-16 17:43:29 +00:00 committed by Ashley Wulber
parent c360a6158e
commit e6010b147a
2 changed files with 26 additions and 19 deletions

View file

@ -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
}