Skip to content

Commit bb68ec6

Browse files
committed
Apply suggestion from PR review
1 parent 41b5ebe commit bb68ec6

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

clippy_lints/src/doc.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,18 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
407407
Start(CodeBlock(ref kind)) => {
408408
in_code = true;
409409
if let CodeBlockKind::Fenced(lang) = kind {
410-
let infos = lang.split(',').collect::<Vec<_>>();
411-
is_rust = !infos.iter().any(|&i| i == "ignore")
412-
&& infos
413-
.iter()
414-
.any(|i| i.is_empty() || i.starts_with("edition") || RUST_CODE.contains(&i));
415-
edition = infos
416-
.iter()
417-
.find_map(|i| i.starts_with("edition").then(|| i[7..].parse::<Edition>().ok()))
418-
.flatten();
410+
for item in lang.split(',') {
411+
if item == "ignore" {
412+
is_rust = false;
413+
break;
414+
}
415+
if let Some(stripped) = item.strip_prefix("edition") {
416+
is_rust = true;
417+
edition = stripped.parse::<Edition>().ok();
418+
} else if item.is_empty() || RUST_CODE.contains(&item) {
419+
is_rust = true;
420+
}
421+
}
419422
}
420423
},
421424
End(CodeBlock(_)) => {

0 commit comments

Comments
 (0)