diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-26 16:37:13 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-26 16:37:13 +0200 |
commit | a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6 (patch) | |
tree | fd7be2fe6d7355d3aafaf8b731f0e0b48624debc /src/content/document.rs | |
parent | 297784cb925b1196d89479fa24c898703ae598d6 (diff) | |
download | markdown-rs-a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6.tar.gz markdown-rs-a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6.tar.bz2 markdown-rs-a6b317ac7fbc95b8584056b3cebffbf9d1bba2c6.zip |
Refactor to drastically improve perf around whitespace
Diffstat (limited to '')
-rw-r--r-- | src/content/document.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/content/document.rs b/src/content/document.rs index 0c3cef7..32b32ba 100644 --- a/src/content/document.rs +++ b/src/content/document.rs @@ -251,12 +251,13 @@ fn container_new_before(tokenizer: &mut Tokenizer, info: DocumentInfo) -> State }); tokenizer.attempt(list_item, |ok| { - let func = if ok { - container_new_after - } else { - containers_after - }; - Box::new(move |t| func(t, info)) + Box::new(move |t| { + if ok { + container_new_after(t, info) + } else { + containers_after(t, info) + } + }) })(tokenizer) }) } |