Skip to content

Commit 7bc1eb4

Browse files
Create a "is_ignore" variable instead of doing the comparison multiple times
1 parent c3ae826 commit 7bc1eb4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustdoc/html/markdown.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
12401240
if !lang_string.rust {
12411241
continue;
12421242
}
1243+
let is_ignore = lang_string.ignore != Ignore::None;
12431244
let syntax = if syntax.is_empty() { None } else { Some(syntax.to_owned()) };
12441245
let (code_start, mut code_end) = match p.next() {
12451246
Some((Event::Text(_), offset)) => (offset.start, offset.end),
@@ -1250,7 +1251,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
12501251
range: offset,
12511252
code,
12521253
syntax,
1253-
is_ignore: lang_string.ignore != Ignore::None,
1254+
is_ignore,
12541255
});
12551256
continue;
12561257
}
@@ -1261,15 +1262,15 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
12611262
range: offset,
12621263
code,
12631264
syntax,
1264-
is_ignore: lang_string.ignore != Ignore::None,
1265+
is_ignore,
12651266
});
12661267
continue;
12671268
}
12681269
};
12691270
while let Some((Event::Text(_), offset)) = p.next() {
12701271
code_end = offset.end;
12711272
}
1272-
(syntax, code_start, code_end, offset, true, lang_string.ignore != Ignore::None)
1273+
(syntax, code_start, code_end, offset, true, is_ignore)
12731274
}
12741275
CodeBlockKind::Indented => {
12751276
// The ending of the offset goes too far sometime so we reduce it by one in

0 commit comments

Comments
 (0)