remove unreachable variants

This commit is contained in:
Edward Shen 2021-02-26 20:36:21 -05:00
parent 17ba292934
commit 2fadd81287
Signed by: edward
GPG key ID: 19182661E818369F

View file

@ -214,12 +214,12 @@ impl Display for ParserError<'_> {
impl Error for ParserError<'_> {} impl Error for ParserError<'_> {}
/// A list of parsers that parsing can fail on. This is used for pretty-printing
/// errors
#[derive(PartialEq, Debug, Clone, Copy)] #[derive(PartialEq, Debug, Clone, Copy)]
enum ParserNode { enum ParserNode {
SectionHeader, SectionHeader,
ConfigName, ConfigName,
ConfigValue,
Comment,
} }
impl Display for ParserNode { impl Display for ParserNode {
@ -227,8 +227,6 @@ impl Display for ParserNode {
match self { match self {
Self::SectionHeader => write!(f, "section header"), Self::SectionHeader => write!(f, "section header"),
Self::ConfigName => write!(f, "config name"), Self::ConfigName => write!(f, "config name"),
Self::ConfigValue => write!(f, "config value"),
Self::Comment => write!(f, "comment"),
} }
} }
} }
@ -659,7 +657,6 @@ fn section<'a, 'b>(
if let Ok((new_i, _)) = section_body(i, node, &mut items) { if let Ok((new_i, _)) = section_body(i, node, &mut items) {
if old_i != new_i { if old_i != new_i {
i = new_i; i = new_i;
// items.push(Event::Key(Cow::Borrowed(key.into())));
} }
} }
@ -755,7 +752,6 @@ fn section_body<'a, 'b, 'c>(
items.push(Event::Whitespace(Cow::Borrowed(whitespace.into()))); items.push(Event::Whitespace(Cow::Borrowed(whitespace.into())));
} }
*node = ParserNode::ConfigValue;
let (i, _) = config_value(i, items)?; let (i, _) = config_value(i, items)?;
Ok((i, ())) Ok((i, ()))
} }