convert hand-written enum as_str matches to strum derives workspace-wide

This commit is contained in:
damocles 2026-09-11 21:06:54 +02:00
commit 299add158f
14 changed files with 70 additions and 113 deletions

View file

@ -38,6 +38,7 @@ reqwest = { workspace = true, features = [
"multipart",
] }
serde = { workspace = true }
strum = { workspace = true }
serde_json = { workspace = true }
# Only for restoring the default SIGPIPE disposition at startup — see
# `restore_sigpipe` in src/main.rs. std has no safe API for it.

View file

@ -14,7 +14,8 @@ use crate::body;
use crate::client::{Client, index};
use crate::verbs::print_json;
#[derive(Copy, Clone, ValueEnum)]
#[derive(Copy, Clone, ValueEnum, strum::IntoStaticStr)]
#[strum(serialize_all = "snake_case")]
pub enum StateArg {
Open,
Closed,
@ -22,10 +23,7 @@ pub enum StateArg {
impl StateArg {
fn as_str(self) -> &'static str {
match self {
Self::Open => "open",
Self::Closed => "closed",
}
self.into()
}
}