diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-25 15:29:11 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-25 15:29:11 +0200 |
commit | 11304728b6607bc2a8d41a640308f3379a25b933 (patch) | |
tree | c49fb64a64e1c39b889a40f48dcd44f87aaea7b1 /src/construct/label_end.rs | |
parent | 9c18ff7858730f0c7782206129375c7efcb7d77f (diff) | |
download | markdown-rs-11304728b6607bc2a8d41a640308f3379a25b933.tar.gz markdown-rs-11304728b6607bc2a8d41a640308f3379a25b933.tar.bz2 markdown-rs-11304728b6607bc2a8d41a640308f3379a25b933.zip |
Improve performance w/ a single feed loop
Diffstat (limited to 'src/construct/label_end.rs')
-rw-r--r-- | src/construct/label_end.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index 35dfcdf..13af833 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -320,7 +320,7 @@ fn reference_not_full(tokenizer: &mut Tokenizer, code: Code, info: Info) -> Stat /// > | [a] b /// ^ /// ``` -fn ok(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> State { +fn ok(tokenizer: &mut Tokenizer, _code: Code, mut info: Info) -> State { // Remove this one and everything after it. let mut left = tokenizer .label_start_stack @@ -345,7 +345,7 @@ fn ok(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> State { info.media.end.1 = tokenizer.events.len() - 1; tokenizer.media_list.push(info.media); tokenizer.register_resolver_before("media".to_string(), Box::new(resolve_media)); - State::Ok(if matches!(code, Code::None) { 0 } else { 1 }) + State::Ok(0) } /// Done, it’s nothing. @@ -526,7 +526,7 @@ fn full_reference(tokenizer: &mut Tokenizer, code: Code) -> State { /// > | [a][b] d /// ^ /// ``` -fn full_reference_after(tokenizer: &mut Tokenizer, code: Code) -> State { +fn full_reference_after(tokenizer: &mut Tokenizer, _code: Code) -> State { let events = &tokenizer.events; let mut index = events.len() - 1; let mut start: Option<usize> = None; @@ -558,7 +558,7 @@ fn full_reference_after(tokenizer: &mut Tokenizer, code: Code) -> State { false, ))) { - State::Ok(if matches!(code, Code::None) { 0 } else { 1 }) + State::Ok(0) } else { State::Nok } |