diff --git a/src/inline.rs b/src/inline.rs index 75feccf..de9356a 100644 --- a/src/inline.rs +++ b/src/inline.rs @@ -116,7 +116,7 @@ impl + Clone> Parser { .or_else(|| self.parse_container(&first)) .or_else(|| self.parse_atom(&first)) .unwrap_or(Event { - kind: if first.kind == lex::Kind::Whitespace { + kind: if matches!(first.kind, lex::Kind::Whitespace) { EventKind::Whitespace } else { EventKind::Str @@ -402,10 +402,9 @@ impl + Clone> Parser { return None; } if matches!(dir, Dir::Both) - && self - .events - .back() - .map_or(false, |ev| matches!(ev.kind, EventKind::Whitespace)) + && self.events.back().map_or(false, |ev| { + matches!(ev.kind, EventKind::Whitespace | EventKind::Atom(Softbreak)) + }) { return None; }