[pbs-devel] [PATCH proxmox 08/19] router: allow `from_str` on Confirmation that is not for `FromStr`
Shannon Sterz
s.sterz at proxmox.com
Thu Mar 6 13:43:38 CET 2025
while usually this would improve ergonomics, in this case it isn't
clear whether all uses of `FromStr` would be considered valid here.
renaming the function would also make the type more confusing to use
as `from_str_with_default` also exists, so keep this for consistency.
this ignores a clippy lint [1].
[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
proxmox-router/src/cli/mod.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/proxmox-router/src/cli/mod.rs b/proxmox-router/src/cli/mod.rs
index 2393da31..7c409f06 100644
--- a/proxmox-router/src/cli/mod.rs
+++ b/proxmox-router/src/cli/mod.rs
@@ -117,6 +117,7 @@ impl Confirmation {
/// let answer = Confirmation::from_str("bogus");
/// assert!(answer.is_err());
/// ```
+ #[allow(clippy::should_implement_trait)]
pub fn from_str(input: &str) -> Result<Self, Error> {
match input.trim() {
"y" | "Y" => Ok(Self::Yes),
--
2.39.5
More information about the pbs-devel
mailing list