added missing PatKind::Path + tests

This commit is contained in:
Andre Bogus 2016-05-31 22:01:56 +02:00 committed by mcarton
parent e18dc948c7
commit 2811dd64ec
3 changed files with 8 additions and 0 deletions

View File

@ -201,6 +201,7 @@ fn check_single_match_opt_like(cx: &LateContext, ex: &Expr, arms: &[Arm], expr:
path.to_string()
}
PatKind::Binding(BindByValue(MutImmutable), ident, None) => ident.node.to_string(),
PatKind::Path(ref path) => path.to_string(),
_ => return,
};

View File

@ -148,6 +148,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
(&PatKind::Binding(ref lb, ref li, ref lp), &PatKind::Binding(ref rb, ref ri, ref rp)) => {
lb == rb && li.node.as_str() == ri.node.as_str() && both(lp, rp, |l, r| self.eq_pat(l, r))
}
(&PatKind::Path(ref l), &PatKind::Path(ref r)) => self.eq_path(l, r),
(&PatKind::Lit(ref l), &PatKind::Lit(ref r)) => self.eq_expr(l, r),
(&PatKind::QPath(ref ls, ref lp), &PatKind::QPath(ref rs, ref rp)) => {
self.eq_qself(ls, rs) && self.eq_path(lp, rp)

View File

@ -216,6 +216,12 @@ fn overlapping() {
11 ... 50 => println!("0 ... 10"),
_ => (),
}
if let None = Some(42) {
// nothing
} else if let None = Some(42) {
// another nothing :-)
}
}
fn main() {