router: allow from_str on Confirmation that is not for FromStr

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@proxmox.com>
This commit is contained in:
Shannon Sterz 2025-03-06 13:43:38 +01:00 committed by Wolfgang Bumiller
parent 92ecc301b6
commit d95a4f25e0

View File

@ -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),