diff --git a/src/cli.rs b/src/cli.rs index 23b36e9..e6a37f8 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -49,7 +49,11 @@ impl Cli { option: Some("layout".into()), }); }; - c.settings.layout = Layout::from_str(l)?; + c.settings.layout = + Layout::from_str(l).map_err(|_| lexopt::Error::UnexpectedValue { + option: "layout".into(), + value: l.into(), + })?; } Short('M') | Long("no-modeline") => c.modeline = false, Short('f') | Long("prefix-func") => c.settings.prefix_func = true, diff --git a/src/lib.rs b/src/lib.rs index 03cec0d..0e4479b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,7 +34,7 @@ pub enum Layout { } impl FromStr for Layout { - type Err = lexopt::Error; + type Err = (); fn from_str(s: &str) -> Result { match s { "default" => Ok(Self::Default), @@ -47,10 +47,7 @@ impl FromStr for Layout { (Some("mini"), n) => { Ok(Self::Mini(n.map_or(0, |x| x.parse().unwrap_or_default()))) } - _ => Err(lexopt::Error::UnexpectedValue { - option: "layout".into(), - value: x.into(), - }), + _ => Err(()), } } }