Replace .map_or(false with Option::is_some_and (#33468)

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2024-09-16 12:03:52 +02:00 committed by GitHub
parent 236cae9ce5
commit 7df30f3788
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 165 additions and 171 deletions

View file

@ -329,7 +329,7 @@ impl BluetoothManager {
let adapter_valid = self
.adapter
.as_ref()
.map_or(false, |a| a.get_address().is_ok());
.is_some_and(|a| a.get_address().is_ok());
if !adapter_valid {
self.adapter = BluetoothAdapter::new().ok();
}
@ -471,9 +471,9 @@ impl BluetoothManager {
services.retain(|s| {
!uuid_is_blocklisted(&s.get_uuid().unwrap_or_default(), Blocklist::All) &&
self.allowed_services.get(device_id).map_or(false, |uuids| {
uuids.contains(&s.get_uuid().unwrap_or_default())
})
self.allowed_services
.get(device_id)
.is_some_and(|uuids| uuids.contains(&s.get_uuid().unwrap_or_default()))
});
for service in &services {
self.cached_services
@ -727,7 +727,7 @@ impl BluetoothManager {
if !self
.allowed_services
.get(&id)
.map_or(false, |s| s.contains(uuid))
.is_some_and(|s| s.contains(uuid))
{
return Err(BluetoothError::Security);
}