diff --git a/rust/tool/shared/src/gc.rs b/rust/tool/shared/src/gc.rs index 85e4398..2dd66b6 100644 --- a/rust/tool/shared/src/gc.rs +++ b/rust/tool/shared/src/gc.rs @@ -80,6 +80,12 @@ impl Roots { } } +impl Default for Roots { + fn default() -> Self { + Self::new() + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/rust/tool/shared/src/os_release.rs b/rust/tool/shared/src/os_release.rs index 42e75c1..cdee3dc 100644 --- a/rust/tool/shared/src/os_release.rs +++ b/rust/tool/shared/src/os_release.rs @@ -1,5 +1,5 @@ -use std::collections::BTreeMap; use std::fmt; +use std::{collections::BTreeMap, str::FromStr}; use anyhow::{Context, Result}; @@ -34,14 +34,17 @@ impl OsRelease { Ok(Self(map)) } +} +impl FromStr for OsRelease { + type Err = anyhow::Error; /// Parse the string representation of a os-release file. /// /// **Beware before reusing this function!** /// /// This parser might not parse all valid os-release files correctly. It is only designed to /// read the `VERSION` key from the os-release of a systemd-boot binary. - pub fn from_str(value: &str) -> Result { + fn from_str(value: &str) -> Result { let mut map = BTreeMap::new(); // All valid lines