remove the two remaining as_str-style wrappers (DeliveryKind::parse, Wanted::parse)
This commit is contained in:
parent
46456f75ce
commit
7773f10646
2 changed files with 11 additions and 26 deletions
|
|
@ -38,13 +38,6 @@ pub enum Wanted {
|
|||
}
|
||||
|
||||
impl Wanted {
|
||||
/// Derived (`strum::EnumString`, the same `snake_case` convention
|
||||
/// `as_str` uses) rather than a hand-written match kept in sync with
|
||||
/// it by hand.
|
||||
fn parse(s: &str) -> Option<Self> {
|
||||
s.parse().ok()
|
||||
}
|
||||
|
||||
/// Seed value from an observed running state (first boot after
|
||||
/// this store lands, or an agent spawned outside the normal path).
|
||||
pub fn from_running(running: bool) -> Self {
|
||||
|
|
@ -121,7 +114,7 @@ impl PowerStore {
|
|||
.context("select agent_power")?;
|
||||
match row {
|
||||
None => Ok(None),
|
||||
Some(stored) => Wanted::parse(&stored).map(Some).with_context(|| {
|
||||
Some(stored) => stored.parse::<Wanted>().ok().map(Some).with_context(|| {
|
||||
format!("agent_power row for {agent} holds an unknown intent {stored:?}")
|
||||
}),
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue