From bca803047ef09eac84c802f2a61fdf4ffe6f5f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20G=C3=B6hrs?= Date: Fri, 10 Jan 2025 08:09:49 +0100 Subject: [PATCH 1/3] dbus: rauc: update_channels: use Option::is_some_and() no ::map_or() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change is inspired by the clippy lint unnecessary_map_or[1] added in version 1.84.0. [1]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or Signed-off-by: Leonard Göhrs --- src/dbus/rauc/update_channels.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbus/rauc/update_channels.rs b/src/dbus/rauc/update_channels.rs index d0a0025..1a5fedd 100644 --- a/src/dbus/rauc/update_channels.rs +++ b/src/dbus/rauc/update_channels.rs @@ -224,14 +224,14 @@ impl UpstreamBundle { pub(super) fn update_install(&mut self, slot_status: &SlotStatus) { let slot_0_is_older = slot_status .get("rootfs_0") - .filter(|r| r.get("boot_status").map_or(false, |b| b == "good")) + .filter(|r| r.get("boot_status").is_some_and(|b| b == "good")) .and_then(|r| r.get("bundle_version")) .and_then(|v| compare_versions(&self.version, v).map(|c| c.is_gt())) .unwrap_or(true); let slot_1_is_older = slot_status .get("rootfs_1") - .filter(|r| r.get("boot_status").map_or(false, |b| b == "good")) + .filter(|r| r.get("boot_status").is_some_and(|b| b == "good")) .and_then(|r| r.get("bundle_version")) .and_then(|v| compare_versions(&self.version, v).map(|c| c.is_gt())) .unwrap_or(true); From 455e52c9e519c69e4389d59bbdaf4bc37eb884f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20G=C3=B6hrs?= Date: Fri, 10 Jan 2025 08:13:17 +0100 Subject: [PATCH 2/3] motd: use Option::is_some_and(...) instead of Option::map_or(false, ...) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change is inspired by the clippy lint unnecessary_map_or[1] added in version 1.84.0. [1]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or Signed-off-by: Leonard Göhrs --- src/motd.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/motd.rs b/src/motd.rs index c1db6c3..c2990d3 100644 --- a/src/motd.rs +++ b/src/motd.rs @@ -211,7 +211,7 @@ pub fn run( .filter_map(|ch| { ch.bundle .as_ref() - .map_or(false, |b| b.newer_than_installed) + .is_some_and(|b| b.newer_than_installed) .then_some(ch.url) }) .collect(); From 9831a819bd35caba095a0b8614ff8aeafecf649b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20G=C3=B6hrs?= Date: Fri, 10 Jan 2025 08:14:37 +0100 Subject: [PATCH 3/3] dbus: systemd: elide unneeded explicit lifetime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is inspired by cargo lint needless_lifetimes[1] which has started complaining about this occurrence starting with version 1.84.0. [1]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes Signed-off-by: Leonard Göhrs --- src/dbus/systemd.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbus/systemd.rs b/src/dbus/systemd.rs index 17173a1..e06f2dd 100644 --- a/src/dbus/systemd.rs +++ b/src/dbus/systemd.rs @@ -80,7 +80,7 @@ impl ServiceStatus { } #[cfg(not(feature = "demo_mode"))] - async fn get<'a>(unit: &service::UnitProxy<'a>) -> Result { + async fn get(unit: &service::UnitProxy<'_>) -> Result { Ok(Self { active_state: unit.active_state().await?, sub_state: unit.sub_state().await?,