diff --git a/clippy_lints/src/blacklisted_name.rs b/clippy_lints/src/blacklisted_name.rs index 9606b2eda327..74d45505a4bc 100644 --- a/clippy_lints/src/blacklisted_name.rs +++ b/clippy_lints/src/blacklisted_name.rs @@ -44,7 +44,7 @@ impl LintPass for BlackListedName { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName { fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) { - if let PatKind::Binding(_, _, ident, _) = pat.node { + if let PatKind::Binding(.., ident, _) = pat.node { if self.blacklist.contains(&ident.name.to_string()) { span_lint( cx, diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index c704a635425d..41afe5ce0d79 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -286,7 +286,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> FxHashMap { + PatKind::Binding(.., ident, ref as_pat) => { if let Entry::Vacant(v) = map.entry(ident.as_str()) { v.insert(cx.tables.pat_ty(pat)); } diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index f0557154f903..4dbb390cd504 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -81,7 +81,7 @@ fn check_closure(cx: &LateContext<'_, '_>, expr: &Expr) { _ => (), } for (a1, a2) in iter_input_pats(decl, body).zip(args) { - if let PatKind::Binding(_, _, ident, _) = a1.pat.node { + if let PatKind::Binding(.., ident, _) = a1.pat.node { // XXXManishearth Should I be checking the binding mode here? if let ExprKind::Path(QPath::Resolved(None, ref p)) = a2.node { if p.segments.len() != 1 { diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index 7c23503507ae..b6e0480d986b 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -274,7 +274,7 @@ impl<'a, 'tcx> Functions { } fn raw_ptr_arg(arg: &hir::Arg, ty: &hir::Ty) -> Option { - if let (&hir::PatKind::Binding(_, id, _, _), &hir::TyKind::Ptr(_)) = (&arg.pat.node, &ty.node) { + if let (&hir::PatKind::Binding(_, id, _, _, _), &hir::TyKind::Ptr(_)) = (&arg.pat.node, &ty.node) { Some(id) } else { None diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index 59e036c715ef..a6d34f2c7a23 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -94,10 +94,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeEnumVariant { |db| { if variant.fields.len() == 1 { let span = match def.variants[i].node.data { - VariantData::Struct(ref fields, _) | VariantData::Tuple(ref fields, _) => { + VariantData::Struct(ref fields, ..) | VariantData::Tuple(ref fields, ..) => { fields[0].ty.span }, - VariantData::Unit(_) => unreachable!(), + VariantData::Unit(..) => unreachable!(), }; if let Some(snip) = snippet_opt(cx, span) { db.span_suggestion( diff --git a/clippy_lints/src/let_if_seq.rs b/clippy_lints/src/let_if_seq.rs index f1aed79847f7..a4f69e321718 100644 --- a/clippy_lints/src/let_if_seq.rs +++ b/clippy_lints/src/let_if_seq.rs @@ -73,7 +73,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq { if_chain! { if let Some(expr) = it.peek(); if let hir::StmtKind::Local(ref local) = stmt.node; - if let hir::PatKind::Binding(mode, canonical_id, ident, None) = local.pat.node; + if let hir::PatKind::Binding(mode, canonical_id, _, ident, None) = local.pat.node; if let hir::StmtKind::Expr(ref if_) = expr.node; if let hir::ExprKind::If(ref cond, ref then, ref else_) = if_.node; if !used_in_expr(cx, canonical_id, cond); diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 06266257d1e5..dcd1a4e0a610 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -969,7 +969,7 @@ fn detect_manual_memcpy<'a, 'tcx>( }) = higher::range(cx, arg) { // the var must be a single name - if let PatKind::Binding(_, canonical_id, _, _) = pat.node { + if let PatKind::Binding(_, canonical_id, _, _, _) = pat.node { let print_sum = |arg1: &Offset, arg2: &Offset| -> String { match (&arg1.value[..], arg1.negate, &arg2.value[..], arg2.negate) { ("0", _, "0", _) => "".into(), @@ -1086,7 +1086,7 @@ fn check_for_loop_range<'a, 'tcx>( }) = higher::range(cx, arg) { // the var must be a single name - if let PatKind::Binding(_, canonical_id, ident, _) = pat.node { + if let PatKind::Binding(_, canonical_id, _, ident, _) = pat.node { let mut visitor = VarVisitor { cx, var: canonical_id, @@ -1637,7 +1637,7 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option(pat: &'tcx PatKind, body: &'tcx Expr) -> bool { match *pat { PatKind::Wild => true, - PatKind::Binding(_, _, ident, None) if ident.as_str().starts_with('_') => { + PatKind::Binding(.., ident, None) if ident.as_str().starts_with('_') => { let mut visitor = UsedVisitor { var: ident.name, used: false, @@ -2095,7 +2095,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> { // Look for declarations of the variable if let StmtKind::Local(ref local) = stmt.node { if local.pat.id == self.var_id { - if let PatKind::Binding(_, _, ident, _) = local.pat.node { + if let PatKind::Binding(.., ident, _) = local.pat.node { self.name = Some(ident.name); self.state = if let Some(ref init) = local.init { @@ -2286,7 +2286,7 @@ impl<'tcx> Visitor<'tcx> for LoopNestVisitor { if self.nesting != Unknown { return; } - if let PatKind::Binding(_, _, span_name, _) = pat.node { + if let PatKind::Binding(.., span_name, _) = pat.node { if self.iterator == span_name.name { self.nesting = RuledOut; return; diff --git a/clippy_lints/src/map_clone.rs b/clippy_lints/src/map_clone.rs index 49bd8f650e56..5699870c307d 100644 --- a/clippy_lints/src/map_clone.rs +++ b/clippy_lints/src/map_clone.rs @@ -70,13 +70,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { then { match closure_body.arguments[0].pat.node { hir::PatKind::Ref(ref inner, _) => if let hir::PatKind::Binding( - hir::BindingAnnotation::Unannotated, _, name, None + hir::BindingAnnotation::Unannotated, .., name, None ) = inner.node { if ident_eq(name, closure_expr) { lint(cx, e.span, args[0].span); } }, - hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, name, None) => { + hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, .., name, None) => { match closure_expr.node { hir::ExprKind::Unary(hir::UnOp::UnDeref, ref inner) => { if ident_eq(name, inner) && !cx.tables.expr_ty(inner).is_box() { diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 6ef073166910..9cb160685ca6 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -338,7 +338,7 @@ fn check_single_match_opt_like( } print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)) }, - PatKind::Binding(BindingAnnotation::Unannotated, _, ident, None) => ident.to_string(), + PatKind::Binding(BindingAnnotation::Unannotated, .., ident, None) => ident.to_string(), PatKind::Path(ref path) => print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)), _ => return, }; @@ -657,7 +657,7 @@ fn is_ref_some_arm(arm: &Arm) -> Option { if_chain! { if let PatKind::TupleStruct(ref path, ref pats, _) = arm.pats[0].node; if pats.len() == 1 && match_qpath(path, &paths::OPTION_SOME); - if let PatKind::Binding(rb, _, ident, _) = pats[0].node; + if let PatKind::Binding(rb, .., ident, _) = pats[0].node; if rb == BindingAnnotation::Ref || rb == BindingAnnotation::RefMut; if let ExprKind::Call(ref e, ref args) = remove_blocks(&arm.body).node; if let ExprKind::Path(ref some_path) = e.node; diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index c15fba76869e..99cdba9402fe 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -264,8 +264,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { } for arg in iter_input_pats(decl, body) { match arg.pat.node { - PatKind::Binding(BindingAnnotation::Ref, _, _, _) - | PatKind::Binding(BindingAnnotation::RefMut, _, _, _) => { + PatKind::Binding(BindingAnnotation::Ref, ..) | PatKind::Binding(BindingAnnotation::RefMut, ..) => { span_lint( cx, TOPLEVEL_REF_ARG, @@ -282,7 +281,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, s: &'tcx Stmt) { if_chain! { if let StmtKind::Local(ref l) = s.node; - if let PatKind::Binding(an, _, i, None) = l.pat.node; + if let PatKind::Binding(an, .., i, None) = l.pat.node; if let Some(ref init) = l.init; then { if an == BindingAnnotation::Ref || an == BindingAnnotation::RefMut { @@ -445,7 +444,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { } fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) { - if let PatKind::Binding(_, _, ident, Some(ref right)) = pat.node { + if let PatKind::Binding(.., ident, Some(ref right)) = pat.node { if let PatKind::Wild = right.node { span_lint( cx, diff --git a/clippy_lints/src/needless_borrow.rs b/clippy_lints/src/needless_borrow.rs index 206a1465a46f..777d2f683f0d 100644 --- a/clippy_lints/src/needless_borrow.rs +++ b/clippy_lints/src/needless_borrow.rs @@ -89,7 +89,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrow { return; } if_chain! { - if let PatKind::Binding(BindingAnnotation::Ref, _, name, _) = pat.node; + if let PatKind::Binding(BindingAnnotation::Ref, .., name, _) = pat.node; if let ty::Ref(_, tam, mutbl) = cx.tables.pat_ty(pat).sty; if mutbl == MutImmutable; if let ty::Ref(_, _, mutbl) = tam.sty; diff --git a/clippy_lints/src/needless_borrowed_ref.rs b/clippy_lints/src/needless_borrowed_ref.rs index bf2857d92881..eae8ed541e22 100644 --- a/clippy_lints/src/needless_borrowed_ref.rs +++ b/clippy_lints/src/needless_borrowed_ref.rs @@ -76,7 +76,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrowedRef { if let PatKind::Ref(ref sub_pat, MutImmutable) = pat.node; // Check sub_pat got a `ref` keyword (excluding `ref mut`). - if let PatKind::Binding(BindingAnnotation::Ref, _, spanned_name, ..) = sub_pat.node; + if let PatKind::Binding(BindingAnnotation::Ref, .., spanned_name, _) = sub_pat.node; then { span_lint_and_then(cx, NEEDLESS_BORROWED_REFERENCE, pat.span, "this pattern takes a reference on something that is being de-referenced", diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index a8cc5eeec9f2..77a6aeba53b0 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -164,7 +164,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue { // Ignore `self`s. if idx == 0 { - if let PatKind::Binding(_, _, ident, ..) = arg.pat.node { + if let PatKind::Binding(.., ident, _) = arg.pat.node { if ident.as_str() == "self" { continue; } diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index 1f341bd22ee8..722f64405c79 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -108,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_fn<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl, body: &'tcx Body) { let mut bindings = Vec::new(); for arg in iter_input_pats(decl, body) { - if let PatKind::Binding(_, _, ident, _) = arg.pat.node { + if let PatKind::Binding(.., ident, _) = arg.pat.node { bindings.push((ident.name, ident.span)) } } @@ -172,7 +172,7 @@ fn check_pat<'a, 'tcx>( ) { // TODO: match more stuff / destructuring match pat.node { - PatKind::Binding(_, _, ident, ref inner) => { + PatKind::Binding(.., ident, ref inner) => { let name = ident.name; if is_binding(cx, pat.hir_id) { let mut new_binding = true; diff --git a/clippy_lints/src/slow_vector_initialization.rs b/clippy_lints/src/slow_vector_initialization.rs index 1f9f369cfe48..b8ab32491a3b 100644 --- a/clippy_lints/src/slow_vector_initialization.rs +++ b/clippy_lints/src/slow_vector_initialization.rs @@ -96,7 +96,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { // Matches statements which initializes vectors. For example: `let mut vec = Vec::with_capacity(10)` if_chain! { if let StmtKind::Local(ref local) = stmt.node; - if let PatKind::Binding(BindingAnnotation::Mutable, _, variable_name, None) = local.pat.node; + if let PatKind::Binding(BindingAnnotation::Mutable, .., variable_name, None) = local.pat.node; if let Some(ref init) = local.init; if let Some(ref len_arg) = Self::is_vec_with_capacity(init); diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index af7fd11c6e58..7b532cdb1725 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -77,7 +77,7 @@ fn check_manual_swap(cx: &LateContext<'_, '_>, block: &Block) { // let t = foo(); if let StmtKind::Local(ref tmp) = w[0].node; if let Some(ref tmp_init) = tmp.init; - if let PatKind::Binding(_, _, ident, None) = tmp.pat.node; + if let PatKind::Binding(.., ident, None) = tmp.pat.node; // foo() = bar(); if let StmtKind::Semi(ref first) = w[1].node; diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index 5a76b965d269..264a5463225d 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -513,7 +513,7 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor { let current = format!("{}.node", self.current); match pat.node { PatKind::Wild => println!("Wild = {};", current), - PatKind::Binding(anno, _, ident, ref sub) => { + PatKind::Binding(anno, .., ident, ref sub) => { let anno_pat = match anno { BindingAnnotation::Unannotated => "BindingAnnotation::Unannotated", BindingAnnotation::Mutable => "BindingAnnotation::Mutable", diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index 2b0b0e7121fa..53876fef5794 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -193,7 +193,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { (&PatKind::TupleStruct(ref lp, ref la, ls), &PatKind::TupleStruct(ref rp, ref ra, rs)) => { self.eq_qpath(lp, rp) && over(la, ra, |l, r| self.eq_pat(l, r)) && ls == rs }, - (&PatKind::Binding(ref lb, _, ref li, ref lp), &PatKind::Binding(ref rb, _, ref ri, ref rp)) => { + (&PatKind::Binding(ref lb, .., ref li, ref lp), &PatKind::Binding(ref rb, .., ref ri, ref rp)) => { lb == rb && li.name.as_str() == ri.name.as_str() && both(lp, rp, |l, r| self.eq_pat(l, r)) }, (&PatKind::Path(ref l), &PatKind::Path(ref r)) => self.eq_qpath(l, r), diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index 758d1d2d3651..508bf26bab90 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -420,7 +420,7 @@ fn print_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat, indent: usize) { println!("{}+", ind); match pat.node { hir::PatKind::Wild => println!("{}Wild", ind), - hir::PatKind::Binding(ref mode, _, ident, ref inner) => { + hir::PatKind::Binding(ref mode, .., ident, ref inner) => { println!("{}Binding", ind); println!("{}mode: {:?}", ind, mode); println!("{}name: {}", ind, ident.name); diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index ee3356fdc823..e68cefe2bc45 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -373,7 +373,7 @@ pub fn get_item_name(cx: &LateContext<'_, '_>, expr: &Expr) -> Option { /// Get the name of a `Pat`, if any pub fn get_pat_name(pat: &Pat) -> Option { match pat.node { - PatKind::Binding(_, _, ref spname, _) => Some(spname.name), + PatKind::Binding(.., ref spname, _) => Some(spname.name), PatKind::Path(ref qpath) => single_segment_path(qpath).map(|ps| ps.ident.name), PatKind::Box(ref p) | PatKind::Ref(ref p, _) => get_pat_name(&*p), _ => None, @@ -1008,7 +1008,7 @@ pub fn opt_def_id(def: Def) -> Option { } pub fn is_self(slf: &Arg) -> bool { - if let PatKind::Binding(_, _, name, _) = slf.pat.node { + if let PatKind::Binding(.., name, _) = slf.pat.node { name.name == keywords::SelfLower.name() } else { false @@ -1038,7 +1038,7 @@ pub fn is_try(expr: &Expr) -> Option<&Expr> { if_chain! { if let PatKind::TupleStruct(ref path, ref pat, None) = arm.pats[0].node; if match_qpath(path, &paths::RESULT_OK[1..]); - if let PatKind::Binding(_, defid, _, None) = pat[0].node; + if let PatKind::Binding(_, defid, _, _, None) = pat[0].node; if let ExprKind::Path(QPath::Resolved(None, ref path)) = arm.body.node; if let Def::Local(lid) = path.def; if lid == defid; @@ -1087,7 +1087,7 @@ pub fn is_allowed(cx: &LateContext<'_, '_>, lint: &'static Lint, id: NodeId) -> pub fn get_arg_name(pat: &Pat) -> Option { match pat.node { - PatKind::Binding(_, _, ident, None) => Some(ident.name), + PatKind::Binding(.., ident, None) => Some(ident.name), PatKind::Ref(ref subpat, _) => get_arg_name(subpat), _ => None, }