diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 2b778e12cb3..b6729d797e8 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -14,7 +14,6 @@ #![allow(indexing_slicing, shadow_reuse, unknown_lints, missing_docs_in_private_items)] #![allow(needless_lifetimes)] -#[macro_use] extern crate syntax; #[macro_use] extern crate rustc; diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index e77251e0321..ab9819c5371 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -361,7 +361,7 @@ fn all_ranges(cx: &LateContext, arms: &[Arm]) -> Vec> { } .filter_map(|pat| { if_let_chain! {[ - let PatKind::Range(ref lhs, ref rhs) = pat.node, + let PatKind::Range(ref lhs, ref rhs, _) = pat.node, let Ok(lhs) = constcx.eval(lhs, ExprTypeChecked), let Ok(rhs) = constcx.eval(rhs, ExprTypeChecked) ], { diff --git a/clippy_lints/src/utils/hir.rs b/clippy_lints/src/utils/hir.rs index 3b1d1a46fac..3bce1b3d7e5 100644 --- a/clippy_lints/src/utils/hir.rs +++ b/clippy_lints/src/utils/hir.rs @@ -160,8 +160,8 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { (&PatKind::Tuple(ref l, ls), &PatKind::Tuple(ref r, rs)) => { ls == rs && over(l, r, |l, r| self.eq_pat(l, r)) }, - (&PatKind::Range(ref ls, ref le), &PatKind::Range(ref rs, ref re)) => { - self.eq_expr(ls, rs) && self.eq_expr(le, re) + (&PatKind::Range(ref ls, ref le, ref li), &PatKind::Range(ref rs, ref re, ref ri)) => { + self.eq_expr(ls, rs) && self.eq_expr(le, re) && (*li == *ri) }, (&PatKind::Ref(ref le, ref lm), &PatKind::Ref(ref re, ref rm)) => lm == rm && self.eq_pat(le, re), (&PatKind::Slice(ref ls, ref li, ref le), &PatKind::Slice(ref rs, ref ri, ref re)) => { diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index d17ed28cd17..e08a7d3bfdb 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -475,10 +475,14 @@ fn print_pat(cx: &LateContext, pat: &hir::Pat, indent: usize) { println!("{}Lit", ind); print_expr(cx, e, indent + 1); }, - hir::PatKind::Range(ref l, ref r) => { + hir::PatKind::Range(ref l, ref r, ref range_end) => { println!("{}Range", ind); print_expr(cx, l, indent + 1); print_expr(cx, r, indent + 1); + match *range_end { + hir::RangeEnd::Included => println!("{} end included", ind), + hir::RangeEnd::Excluded => println!("{} end excluded", ind), + } }, hir::PatKind::Slice(ref first_pats, ref range, ref last_pats) => { println!("{}Slice [a, b, ..i, y, z]", ind);