in common.rs:
impl FromStr for $name {
type Err = ();
fn from_str(s: &str) -> Result<Self, ()> {
match s {
$($repr => Ok(Self::$variant),)*
_ => Err(()),
}
}
}
the error type being unit means if you pass an unrecognized option to any string enum flag, you get a very unhelpful error (it just prints ()).
if it was changed to the following:
impl FromStr for $name {
type Err = String;
fn from_str(s: &str) -> Result<Self, String> {
match s {
$($repr => Ok(Self::$variant),)*
_ => Err(s.to_string()),
}
}
}
you would at least get an error message that says what the unrecognized argument is.
i would file a PR myself but the build system seems to be falling apart at the seams for me.
in
common.rs:the error type being unit means if you pass an unrecognized option to any string enum flag, you get a very unhelpful error (it just prints
()).if it was changed to the following:
you would at least get an error message that says what the unrecognized argument is.
i would file a PR myself but the build system seems to be falling apart at the seams for me.