diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-22 17:16:38 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-22 17:16:38 +0200 |
commit | b945e43103544fc31a0755841b380358b2c161e6 (patch) | |
tree | 80c6091c4268e6fec5cce02a08cdf6fa2b434300 /src/construct/partial_whitespace.rs | |
parent | 41fc406af206e21014eaaba94bcf6b1854f892b3 (diff) | |
download | markdown-rs-b945e43103544fc31a0755841b380358b2c161e6.tar.gz markdown-rs-b945e43103544fc31a0755841b380358b2c161e6.tar.bz2 markdown-rs-b945e43103544fc31a0755841b380358b2c161e6.zip |
Refactor to remove unneeded tuples in every states
Diffstat (limited to '')
-rw-r--r-- | src/construct/partial_whitespace.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/construct/partial_whitespace.rs b/src/construct/partial_whitespace.rs index 7624ec0..4fc013e 100644 --- a/src/construct/partial_whitespace.rs +++ b/src/construct/partial_whitespace.rs @@ -24,10 +24,10 @@ //! [space_or_tab_eol]: crate::construct::partial_space_or_tab::space_or_tab_eol use super::partial_space_or_tab::space_or_tab; -use crate::tokenizer::{Code, State, StateFnResult, Tokenizer}; +use crate::tokenizer::{Code, State, Tokenizer}; /// Parse initial or final whitespace. -pub fn whitespace(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { +pub fn whitespace(tokenizer: &mut Tokenizer, code: Code) -> State { tokenizer.go( // Nothing if there’s no whitespace. space_or_tab(), @@ -45,18 +45,18 @@ pub fn whitespace(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { } /// After whitespace, at an eol/eof. -fn at_eol(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { +fn at_eol(tokenizer: &mut Tokenizer, code: Code) -> State { if matches!( code, Code::None | Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') ) { ok(tokenizer, code) } else { - (State::Nok, 0) + State::Nok } } /// Fine. -fn ok(_tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { - (State::Ok, if matches!(code, Code::None) { 0 } else { 1 }) +fn ok(_tokenizer: &mut Tokenizer, code: Code) -> State { + State::Ok(if matches!(code, Code::None) { 0 } else { 1 }) } |