We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ac5250c + 622eed3 commit 9ffec60Copy full SHA for 9ffec60
src/arg_parsers/filter.rs
@@ -47,17 +47,9 @@ impl TryFrom<&OsStr> for Filter {
47
type Error = ArgParseErr;
48
49
fn try_from(s: &OsStr) -> Result<Self, Self::Error> {
50
- if let Some(s_utf8) = s.to_str() {
51
- if let Ok(known_filter) = Self::try_from(s_utf8) {
52
- return Ok(known_filter);
53
- }
54
55
- Err(ArgParseErr {
56
- message: Some(format!(
57
- "unrecognized image filter `{}'",
58
- s.to_string_lossy()
59
- )),
60
- })
+ s.to_str()
+ .ok_or_else(|| ArgParseErr::with_msg("non-utf8 filter value"))
+ .and_then(|val| Filter::try_from(val).map_err(ArgParseErr::with_msg))
61
}
62
63
0 commit comments