Skip to content

Commit

Permalink
fix: use of undeclared crate or module lexopt
Browse files Browse the repository at this point in the history
  • Loading branch information
numToStr committed Nov 18, 2022
1 parent b993b7b commit 43fcda3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub enum Layout {
}

impl FromStr for Layout {
type Err = lexopt::Error;
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"default" => Ok(Self::Default),
Expand All @@ -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(()),
}
}
}
Expand Down

0 comments on commit 43fcda3

Please sign in to comment.