Create a "is_ignore" variable instead of doing the comparison multiple times
This commit is contained in:
parent
c3ae826901
commit
7bc1eb4506
1 changed files with 4 additions and 3 deletions
|
|
@ -1240,6 +1240,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
|
|||
if !lang_string.rust {
|
||||
continue;
|
||||
}
|
||||
let is_ignore = lang_string.ignore != Ignore::None;
|
||||
let syntax = if syntax.is_empty() { None } else { Some(syntax.to_owned()) };
|
||||
let (code_start, mut code_end) = match p.next() {
|
||||
Some((Event::Text(_), offset)) => (offset.start, offset.end),
|
||||
|
|
@ -1250,7 +1251,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
|
|||
range: offset,
|
||||
code,
|
||||
syntax,
|
||||
is_ignore: lang_string.ignore != Ignore::None,
|
||||
is_ignore,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1261,7 +1262,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
|
|||
range: offset,
|
||||
code,
|
||||
syntax,
|
||||
is_ignore: lang_string.ignore != Ignore::None,
|
||||
is_ignore,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1269,7 +1270,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
|
|||
while let Some((Event::Text(_), offset)) = p.next() {
|
||||
code_end = offset.end;
|
||||
}
|
||||
(syntax, code_start, code_end, offset, true, lang_string.ignore != Ignore::None)
|
||||
(syntax, code_start, code_end, offset, true, is_ignore)
|
||||
}
|
||||
CodeBlockKind::Indented => {
|
||||
// The ending of the offset goes too far sometime so we reduce it by one in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue