From 43fcda3b94dda8ee24c021fd58e73896738a736a Mon Sep 17 00:00:00 2001 From: numToStr Date: Fri, 18 Nov 2022 18:52:00 +0530 Subject: [PATCH] fix: use of undeclared crate or module `lexopt` --- src/cli.rs | 6 +++++- src/lib.rs | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) 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(()), } } }