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/hard_break_trailing.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 'src/construct/hard_break_trailing.rs')
-rw-r--r-- | src/construct/hard_break_trailing.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/construct/hard_break_trailing.rs b/src/construct/hard_break_trailing.rs index c5861f7..8ce4201 100644 --- a/src/construct/hard_break_trailing.rs +++ b/src/construct/hard_break_trailing.rs @@ -42,7 +42,7 @@ use crate::constant::HARD_BREAK_PREFIX_SIZE_MIN; use crate::token::Token; -use crate::tokenizer::{Code, State, StateFnResult, Tokenizer}; +use crate::tokenizer::{Code, State, Tokenizer}; /// Start of a hard break (trailing). /// @@ -51,15 +51,15 @@ use crate::tokenizer::{Code, State, StateFnResult, Tokenizer}; /// ^ /// | b /// ``` -pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { +pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State { match code { Code::Char(' ') if tokenizer.parse_state.constructs.hard_break_trailing => { tokenizer.enter(Token::HardBreakTrailing); tokenizer.enter(Token::HardBreakTrailingSpace); tokenizer.consume(code); - (State::Fn(Box::new(|t, c| inside(t, c, 1))), 0) + State::Fn(Box::new(|t, c| inside(t, c, 1))) } - _ => (State::Nok, 0), + _ => State::Nok, } } @@ -70,19 +70,19 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { /// ^ /// | b /// ``` -fn inside(tokenizer: &mut Tokenizer, code: Code, size: usize) -> StateFnResult { +fn inside(tokenizer: &mut Tokenizer, code: Code, size: usize) -> State { match code { Code::Char(' ') => { tokenizer.consume(code); - (State::Fn(Box::new(move |t, c| inside(t, c, size + 1))), 0) + State::Fn(Box::new(move |t, c| inside(t, c, size + 1))) } Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') if size >= HARD_BREAK_PREFIX_SIZE_MIN => { tokenizer.exit(Token::HardBreakTrailingSpace); tokenizer.exit(Token::HardBreakTrailing); - (State::Ok, if matches!(code, Code::None) { 0 } else { 1 }) + State::Ok(if matches!(code, Code::None) { 0 } else { 1 }) } - _ => (State::Nok, 0), + _ => State::Nok, } } |