diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-01-03 14:56:56 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-01-03 14:56:56 +0100 |
| commit | 7bc1eb4506170e0750de4757af97f341c427a35a (patch) | |
| tree | 736b654af0b25d74130b32f66de0d4a1ce7a3cb2 | |
| parent | c3ae82690150a9edc09ceef6319eabedfebf3931 (diff) | |
| download | rust-7bc1eb4506170e0750de4757af97f341c427a35a.tar.gz rust-7bc1eb4506170e0750de4757af97f341c427a35a.zip | |
Create a "is_ignore" variable instead of doing the comparison multiple times
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index f1d00b81eed..291a01d7468 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -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 |
