Skip to content

Commit f07ee8a

Browse files
committed
Auto merge of #8232 - Jarcho:match_same_arm_860, r=xFrednet
`match_same_arms` fix fixes #860 fixes #1140 changelog: Don't lint `match_same_arms` when an interposing arm's pattern would overlap
2 parents 4a07662 + 773d203 commit f07ee8a

File tree

7 files changed

+618
-249
lines changed

7 files changed

+618
-249
lines changed

clippy_lints/src/doc.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,6 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
637637
loop {
638638
match parser.parse_item(ForceCollect::No) {
639639
Ok(Some(item)) => match &item.kind {
640-
// Tests with one of these items are ignored
641-
ItemKind::Static(..)
642-
| ItemKind::Const(..)
643-
| ItemKind::ExternCrate(..)
644-
| ItemKind::ForeignMod(..) => return false,
645-
// We found a main function ...
646640
ItemKind::Fn(box Fn {
647641
sig, body: Some(block), ..
648642
}) if item.ident.name == sym::main => {
@@ -661,8 +655,13 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
661655
return false;
662656
}
663657
},
664-
// Another function was found; this case is ignored too
665-
ItemKind::Fn(..) => return false,
658+
// Tests with one of these items are ignored
659+
ItemKind::Static(..)
660+
| ItemKind::Const(..)
661+
| ItemKind::ExternCrate(..)
662+
| ItemKind::ForeignMod(..)
663+
// Another function was found; this case is ignored
664+
| ItemKind::Fn(..) => return false,
666665
_ => {},
667666
},
668667
Ok(None) => break,

clippy_lints/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
// FIXME: switch to something more ergonomic here, once available.
2525
// (Currently there is no way to opt into sysroot crates without `extern crate`.)
26+
extern crate rustc_arena;
2627
extern crate rustc_ast;
2728
extern crate rustc_ast_pretty;
2829
extern crate rustc_attr;

0 commit comments

Comments
 (0)