From 395b13daf6dd6da0204302d344caa710ea891d62 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 12 Aug 2022 19:04:31 +0200 Subject: Refactor to attempt less if never needed --- src/construct/block_quote.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/construct/block_quote.rs') diff --git a/src/construct/block_quote.rs b/src/construct/block_quote.rs index 6e660cb..4f0870f 100644 --- a/src/construct/block_quote.rs +++ b/src/construct/block_quote.rs @@ -64,16 +64,20 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { /// ^ /// ``` pub fn cont_start(tokenizer: &mut Tokenizer) -> State { - tokenizer.attempt(State::Next(StateName::BlockQuoteContBefore), State::Nok); - State::Retry(space_or_tab_min_max( - tokenizer, - 0, - if tokenizer.parse_state.constructs.code_indented { - TAB_SIZE - 1 - } else { - usize::MAX - }, - )) + if matches!(tokenizer.current, Some(b'\t' | b' ')) { + tokenizer.attempt(State::Next(StateName::BlockQuoteContBefore), State::Nok); + State::Retry(space_or_tab_min_max( + tokenizer, + 1, + if tokenizer.parse_state.constructs.code_indented { + TAB_SIZE - 1 + } else { + usize::MAX + }, + )) + } else { + State::Retry(StateName::BlockQuoteContBefore) + } } /// At `>`, after optional whitespace. -- cgit