fixup! inline fixup

This commit is contained in:
Noah Hellman 2023-01-26 21:55:12 +01:00
parent 641e904074
commit b78b2866a8

View file

@ -398,7 +398,7 @@ impl<I: Iterator<Item = char> + Clone> Parser<I> {
*d == delim || matches!((d, delim), (Delim::Span(..), Delim::Span(..)))
})
.and_then(|o| {
if !dir.can_close() {
if matches!(dir, Dir::Open) {
return None;
}
let (d, e) = self.openers[o];
@ -473,7 +473,7 @@ impl<I: Iterator<Item = char> + Clone> Parser<I> {
event_closer
})
.or_else(|| {
if !dir.can_open() {
if matches!(dir, Dir::Close) {
return None;
}
self.openers.push((delim, self.events.len()));
@ -584,16 +584,6 @@ enum Dir {
Both,
}
impl Dir {
fn can_open(self) -> bool {
matches!(self, Dir::Open | Dir::Both)
}
fn can_close(self) -> bool {
matches!(self, Dir::Close | Dir::Both)
}
}
impl Delim {
fn from_token(kind: lex::Kind) -> Option<(Self, Dir)> {
use Delim::*;