aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/partial_whitespace.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/partial_whitespace.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 'src/construct/partial_whitespace.rs')
-rw-r--r--src/construct/partial_whitespace.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/construct/partial_whitespace.rs b/src/construct/partial_whitespace.rs
index 023c52f..afff1c4 100644
--- a/src/construct/partial_whitespace.rs
+++ b/src/construct/partial_whitespace.rs
@@ -27,7 +27,7 @@ use super::partial_space_or_tab::space_or_tab;
use crate::tokenizer::{Code, State, Tokenizer};
/// Parse initial or final whitespace.
-pub fn whitespace(tokenizer: &mut Tokenizer, code: Code) -> State {
+pub fn whitespace(tokenizer: &mut Tokenizer) -> State {
tokenizer.go(
// Nothing if there’s no whitespace.
space_or_tab(),
@@ -41,22 +41,22 @@ pub fn whitespace(tokenizer: &mut Tokenizer, code: Code) -> State {
// If there’s whitespace, and we were not at an eol/eof, there must be one here.
at_eol
},
- )(tokenizer, code)
+ )(tokenizer)
}
/// After whitespace, at an eol/eof.
-fn at_eol(tokenizer: &mut Tokenizer, code: Code) -> State {
+fn at_eol(tokenizer: &mut Tokenizer) -> State {
if matches!(
- code,
+ tokenizer.current,
Code::None | Code::CarriageReturnLineFeed | Code::Char('\n' | '\r')
) {
- ok(tokenizer, code)
+ ok(tokenizer)
} else {
State::Nok
}
}
/// Fine.
-fn ok(_tokenizer: &mut Tokenizer, _code: Code) -> State {
+fn ok(_tokenizer: &mut Tokenizer) -> State {
State::Ok
}