aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/construct/code_fenced.rs14
-rw-r--r--src/construct/html_flow.rs30
2 files changed, 17 insertions, 27 deletions
diff --git a/src/construct/code_fenced.rs b/src/construct/code_fenced.rs
index cf3336b..a8a4009 100644
--- a/src/construct/code_fenced.rs
+++ b/src/construct/code_fenced.rs
@@ -178,8 +178,6 @@ struct Info {
prefix: usize,
/// Kind of fences.
kind: Kind,
- /// To do.
- concrete: bool,
}
/// Start of fenced code.
@@ -223,7 +221,6 @@ fn before_sequence_open(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult
Info {
prefix,
size: 0,
- concrete: tokenizer.concrete,
kind: Kind::from_code(code),
},
)
@@ -381,7 +378,7 @@ fn at_break(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult
if ok {
Box::new(move |t, c| at_non_lazy_break(t, c, info))
} else {
- Box::new(move |t, c| after(t, c, info))
+ Box::new(after)
}
})(tokenizer, code)
}
@@ -394,7 +391,7 @@ fn at_non_lazy_break(tokenizer: &mut Tokenizer, code: Code, info: Info) -> State
|t, c| close_begin(t, c, info),
|ok| {
if ok {
- Box::new(|t, c| after(t, c, clone))
+ Box::new(after)
} else {
Box::new(|t, c| content_before(t, c, clone))
}
@@ -578,12 +575,11 @@ fn content_continue(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateF
/// console.log('1')
/// ~~~|
/// ```
-#[allow(clippy::needless_pass_by_value)]
-fn after(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult {
+fn after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
tokenizer.exit(Token::CodeFenced);
// Feel free to interrupt.
tokenizer.interrupt = false;
- // Restore previous `concrete`.
- tokenizer.concrete = info.concrete;
+ // No longer concrete.
+ tokenizer.concrete = false;
(State::Ok, Some(vec![code]))
}
diff --git a/src/construct/html_flow.rs b/src/construct/html_flow.rs
index c749679..429a1e8 100644
--- a/src/construct/html_flow.rs
+++ b/src/construct/html_flow.rs
@@ -195,8 +195,6 @@ struct Info {
index: usize,
/// Current quote, when in a double or single quoted attribute value.
quote: Option<QuoteKind>,
- /// To do.
- concrete: bool,
}
/// Start of HTML (flow), before optional whitespace.
@@ -251,7 +249,6 @@ fn open(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
buffer: vec![],
index: 0,
quote: None,
- concrete: tokenizer.concrete,
};
match code {
@@ -782,12 +779,11 @@ fn continuation(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnRes
{
tokenizer.exit(Token::HtmlFlowData);
tokenizer.check(blank_line_before, |ok| {
- let func = if ok {
- html_continue_after
+ if ok {
+ Box::new(html_continue_after)
} else {
- html_continue_start // continuation_at_line_ending
- };
- Box::new(move |t, c| func(t, c, info))
+ Box::new(move |t, c| html_continue_start(t, c, info))
+ }
})(tokenizer, code)
}
Code::None | Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => {
@@ -818,23 +814,21 @@ fn continuation_at_line_ending(tokenizer: &mut Tokenizer, code: Code, info: Info
/// ```
fn html_continue_start(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult {
tokenizer.check(partial_non_lazy_continuation, |ok| {
- let func = if ok {
- html_continue_start_non_lazy
+ if ok {
+ Box::new(move |t, c| html_continue_start_non_lazy(t, c, info))
} else {
- html_continue_after
- };
- Box::new(move |t, c| func(t, c, info))
+ Box::new(html_continue_after)
+ }
})(tokenizer, code)
}
/// To do.
-#[allow(clippy::needless_pass_by_value)]
-fn html_continue_after(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult {
+fn html_continue_after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
tokenizer.exit(Token::HtmlFlow);
// Feel free to interrupt.
tokenizer.interrupt = false;
- // Restore previous `concrete`.
- tokenizer.concrete = info.concrete;
+ // No longer concrete.
+ tokenizer.concrete = false;
(State::Ok, Some(vec![code]))
}
@@ -1015,7 +1009,7 @@ fn continuation_close(tokenizer: &mut Tokenizer, code: Code, info: Info) -> Stat
match code {
Code::None | Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => {
tokenizer.exit(Token::HtmlFlowData);
- html_continue_after(tokenizer, code, info)
+ html_continue_after(tokenizer, code)
}
_ => {
tokenizer.consume(code);