aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/hard_break_trailing.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-25 17:42:20 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-25 17:42:20 +0200
commit5ee6edf222658e73ee97871972b6fbeef444451b (patch)
treec9233c7a8584a2d027ef1b7443e3e5b59918ca2b /src/construct/hard_break_trailing.rs
parent91dc4b1f461fa76df7163f68b2a6db361a71beea (diff)
downloadmarkdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.tar.gz
markdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.tar.bz2
markdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.zip
Refactor to not pass codes around
Diffstat (limited to '')
-rw-r--r--src/construct/hard_break_trailing.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/construct/hard_break_trailing.rs b/src/construct/hard_break_trailing.rs
index 1d1f10f..f0ef83b 100644
--- a/src/construct/hard_break_trailing.rs
+++ b/src/construct/hard_break_trailing.rs
@@ -51,13 +51,13 @@ use crate::tokenizer::{Code, State, Tokenizer};
/// ^
/// | b
/// ```
-pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State {
- match code {
+pub fn start(tokenizer: &mut Tokenizer) -> State {
+ match tokenizer.current {
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)))
+ tokenizer.consume();
+ State::Fn(Box::new(|t| inside(t, 1)))
}
_ => State::Nok,
}
@@ -70,11 +70,11 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State {
/// ^
/// | b
/// ```
-fn inside(tokenizer: &mut Tokenizer, code: Code, size: usize) -> State {
- match code {
+fn inside(tokenizer: &mut Tokenizer, size: usize) -> State {
+ match tokenizer.current {
Code::Char(' ') => {
- tokenizer.consume(code);
- State::Fn(Box::new(move |t, c| inside(t, c, size + 1)))
+ tokenizer.consume();
+ State::Fn(Box::new(move |t| inside(t, size + 1)))
}
Code::CarriageReturnLineFeed | Code::Char('\n' | '\r')
if size >= HARD_BREAK_PREFIX_SIZE_MIN =>