Skip to content

Commit 3bda548

Browse files
committed
Auto merge of #3736 - mikerite:fix-build-20190203, r=phansch
Fix breakage due to rust-lang/rust#58079 The rustc change added HirId to a few nodes. As I understand it, the plan is to remove the NodeId from these nodes eventually. Where the NodeId was not being matched, I used `..` to try and avoid further breakage. Where it was, I used `_` to make the fix easier when NodeId is removed.
2 parents 27b5dd8 + c02367c commit 3bda548

20 files changed

+34
-35
lines changed

clippy_lints/src/blacklisted_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl LintPass for BlackListedName {
4444

4545
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName {
4646
fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) {
47-
if let PatKind::Binding(_, _, ident, _) = pat.node {
47+
if let PatKind::Binding(.., ident, _) = pat.node {
4848
if self.blacklist.contains(&ident.name.to_string()) {
4949
span_lint(
5050
cx,

clippy_lints/src/copies.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> FxHashMap<LocalI
286286
bindings_impl(cx, pat, map);
287287
}
288288
},
289-
PatKind::Binding(_, _, ident, ref as_pat) => {
289+
PatKind::Binding(.., ident, ref as_pat) => {
290290
if let Entry::Vacant(v) = map.entry(ident.as_str()) {
291291
v.insert(cx.tables.pat_ty(pat));
292292
}

clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn check_closure(cx: &LateContext<'_, '_>, expr: &Expr) {
8181
_ => (),
8282
}
8383
for (a1, a2) in iter_input_pats(decl, body).zip(args) {
84-
if let PatKind::Binding(_, _, ident, _) = a1.pat.node {
84+
if let PatKind::Binding(.., ident, _) = a1.pat.node {
8585
// XXXManishearth Should I be checking the binding mode here?
8686
if let ExprKind::Path(QPath::Resolved(None, ref p)) = a2.node {
8787
if p.segments.len() != 1 {

clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl<'a, 'tcx> Functions {
274274
}
275275

276276
fn raw_ptr_arg(arg: &hir::Arg, ty: &hir::Ty) -> Option<ast::NodeId> {
277-
if let (&hir::PatKind::Binding(_, id, _, _), &hir::TyKind::Ptr(_)) = (&arg.pat.node, &ty.node) {
277+
if let (&hir::PatKind::Binding(_, id, _, _, _), &hir::TyKind::Ptr(_)) = (&arg.pat.node, &ty.node) {
278278
Some(id)
279279
} else {
280280
None

clippy_lints/src/large_enum_variant.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeEnumVariant {
9494
|db| {
9595
if variant.fields.len() == 1 {
9696
let span = match def.variants[i].node.data {
97-
VariantData::Struct(ref fields, _) | VariantData::Tuple(ref fields, _) => {
97+
VariantData::Struct(ref fields, ..) | VariantData::Tuple(ref fields, ..) => {
9898
fields[0].ty.span
9999
},
100-
VariantData::Unit(_) => unreachable!(),
100+
VariantData::Unit(..) => unreachable!(),
101101
};
102102
if let Some(snip) = snippet_opt(cx, span) {
103103
db.span_suggestion(

clippy_lints/src/let_if_seq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq {
7373
if_chain! {
7474
if let Some(expr) = it.peek();
7575
if let hir::StmtKind::Local(ref local) = stmt.node;
76-
if let hir::PatKind::Binding(mode, canonical_id, ident, None) = local.pat.node;
76+
if let hir::PatKind::Binding(mode, canonical_id, _, ident, None) = local.pat.node;
7777
if let hir::StmtKind::Expr(ref if_) = expr.node;
7878
if let hir::ExprKind::If(ref cond, ref then, ref else_) = if_.node;
7979
if !used_in_expr(cx, canonical_id, cond);

clippy_lints/src/loops.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ fn detect_manual_memcpy<'a, 'tcx>(
969969
}) = higher::range(cx, arg)
970970
{
971971
// the var must be a single name
972-
if let PatKind::Binding(_, canonical_id, _, _) = pat.node {
972+
if let PatKind::Binding(_, canonical_id, _, _, _) = pat.node {
973973
let print_sum = |arg1: &Offset, arg2: &Offset| -> String {
974974
match (&arg1.value[..], arg1.negate, &arg2.value[..], arg2.negate) {
975975
("0", _, "0", _) => "".into(),
@@ -1086,7 +1086,7 @@ fn check_for_loop_range<'a, 'tcx>(
10861086
}) = higher::range(cx, arg)
10871087
{
10881088
// the var must be a single name
1089-
if let PatKind::Binding(_, canonical_id, ident, _) = pat.node {
1089+
if let PatKind::Binding(_, canonical_id, _, ident, _) = pat.node {
10901090
let mut visitor = VarVisitor {
10911091
cx,
10921092
var: canonical_id,
@@ -1637,7 +1637,7 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<NodeId
16371637
let node_str = cx.tcx.hir().get(node_id);
16381638
if_chain! {
16391639
if let Node::Binding(pat) = node_str;
1640-
if let PatKind::Binding(bind_ann, _, _, _) = pat.node;
1640+
if let PatKind::Binding(bind_ann, ..) = pat.node;
16411641
if let BindingAnnotation::Mutable = bind_ann;
16421642
then {
16431643
return Some(node_id);
@@ -1670,7 +1670,7 @@ fn check_for_mutation(
16701670
fn pat_is_wild<'tcx>(pat: &'tcx PatKind, body: &'tcx Expr) -> bool {
16711671
match *pat {
16721672
PatKind::Wild => true,
1673-
PatKind::Binding(_, _, ident, None) if ident.as_str().starts_with('_') => {
1673+
PatKind::Binding(.., ident, None) if ident.as_str().starts_with('_') => {
16741674
let mut visitor = UsedVisitor {
16751675
var: ident.name,
16761676
used: false,
@@ -2095,7 +2095,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
20952095
// Look for declarations of the variable
20962096
if let StmtKind::Local(ref local) = stmt.node {
20972097
if local.pat.id == self.var_id {
2098-
if let PatKind::Binding(_, _, ident, _) = local.pat.node {
2098+
if let PatKind::Binding(.., ident, _) = local.pat.node {
20992099
self.name = Some(ident.name);
21002100

21012101
self.state = if let Some(ref init) = local.init {
@@ -2286,7 +2286,7 @@ impl<'tcx> Visitor<'tcx> for LoopNestVisitor {
22862286
if self.nesting != Unknown {
22872287
return;
22882288
}
2289-
if let PatKind::Binding(_, _, span_name, _) = pat.node {
2289+
if let PatKind::Binding(.., span_name, _) = pat.node {
22902290
if self.iterator == span_name.name {
22912291
self.nesting = RuledOut;
22922292
return;

clippy_lints/src/map_clone.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
7070
then {
7171
match closure_body.arguments[0].pat.node {
7272
hir::PatKind::Ref(ref inner, _) => if let hir::PatKind::Binding(
73-
hir::BindingAnnotation::Unannotated, _, name, None
73+
hir::BindingAnnotation::Unannotated, .., name, None
7474
) = inner.node {
7575
if ident_eq(name, closure_expr) {
7676
lint(cx, e.span, args[0].span);
7777
}
7878
},
79-
hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, name, None) => {
79+
hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, .., name, None) => {
8080
match closure_expr.node {
8181
hir::ExprKind::Unary(hir::UnOp::UnDeref, ref inner) => {
8282
if ident_eq(name, inner) && !cx.tables.expr_ty(inner).is_box() {

clippy_lints/src/matches.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ fn check_single_match_opt_like(
338338
}
339339
print::to_string(print::NO_ANN, |s| s.print_qpath(path, false))
340340
},
341-
PatKind::Binding(BindingAnnotation::Unannotated, _, ident, None) => ident.to_string(),
341+
PatKind::Binding(BindingAnnotation::Unannotated, .., ident, None) => ident.to_string(),
342342
PatKind::Path(ref path) => print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)),
343343
_ => return,
344344
};
@@ -657,7 +657,7 @@ fn is_ref_some_arm(arm: &Arm) -> Option<BindingAnnotation> {
657657
if_chain! {
658658
if let PatKind::TupleStruct(ref path, ref pats, _) = arm.pats[0].node;
659659
if pats.len() == 1 && match_qpath(path, &paths::OPTION_SOME);
660-
if let PatKind::Binding(rb, _, ident, _) = pats[0].node;
660+
if let PatKind::Binding(rb, .., ident, _) = pats[0].node;
661661
if rb == BindingAnnotation::Ref || rb == BindingAnnotation::RefMut;
662662
if let ExprKind::Call(ref e, ref args) = remove_blocks(&arm.body).node;
663663
if let ExprKind::Path(ref some_path) = e.node;

clippy_lints/src/misc.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
264264
}
265265
for arg in iter_input_pats(decl, body) {
266266
match arg.pat.node {
267-
PatKind::Binding(BindingAnnotation::Ref, _, _, _)
268-
| PatKind::Binding(BindingAnnotation::RefMut, _, _, _) => {
267+
PatKind::Binding(BindingAnnotation::Ref, ..) | PatKind::Binding(BindingAnnotation::RefMut, ..) => {
269268
span_lint(
270269
cx,
271270
TOPLEVEL_REF_ARG,
@@ -282,7 +281,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
282281
fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, s: &'tcx Stmt) {
283282
if_chain! {
284283
if let StmtKind::Local(ref l) = s.node;
285-
if let PatKind::Binding(an, _, i, None) = l.pat.node;
284+
if let PatKind::Binding(an, .., i, None) = l.pat.node;
286285
if let Some(ref init) = l.init;
287286
then {
288287
if an == BindingAnnotation::Ref || an == BindingAnnotation::RefMut {
@@ -445,7 +444,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
445444
}
446445

447446
fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) {
448-
if let PatKind::Binding(_, _, ident, Some(ref right)) = pat.node {
447+
if let PatKind::Binding(.., ident, Some(ref right)) = pat.node {
449448
if let PatKind::Wild = right.node {
450449
span_lint(
451450
cx,

clippy_lints/src/needless_borrow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrow {
8989
return;
9090
}
9191
if_chain! {
92-
if let PatKind::Binding(BindingAnnotation::Ref, _, name, _) = pat.node;
92+
if let PatKind::Binding(BindingAnnotation::Ref, .., name, _) = pat.node;
9393
if let ty::Ref(_, tam, mutbl) = cx.tables.pat_ty(pat).sty;
9494
if mutbl == MutImmutable;
9595
if let ty::Ref(_, _, mutbl) = tam.sty;

clippy_lints/src/needless_borrowed_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrowedRef {
7676
if let PatKind::Ref(ref sub_pat, MutImmutable) = pat.node;
7777

7878
// Check sub_pat got a `ref` keyword (excluding `ref mut`).
79-
if let PatKind::Binding(BindingAnnotation::Ref, _, spanned_name, ..) = sub_pat.node;
79+
if let PatKind::Binding(BindingAnnotation::Ref, .., spanned_name, _) = sub_pat.node;
8080
then {
8181
span_lint_and_then(cx, NEEDLESS_BORROWED_REFERENCE, pat.span,
8282
"this pattern takes a reference on something that is being de-referenced",

clippy_lints/src/needless_pass_by_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
164164

165165
// Ignore `self`s.
166166
if idx == 0 {
167-
if let PatKind::Binding(_, _, ident, ..) = arg.pat.node {
167+
if let PatKind::Binding(.., ident, _) = arg.pat.node {
168168
if ident.as_str() == "self" {
169169
continue;
170170
}

clippy_lints/src/shadow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
108108
fn check_fn<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl, body: &'tcx Body) {
109109
let mut bindings = Vec::new();
110110
for arg in iter_input_pats(decl, body) {
111-
if let PatKind::Binding(_, _, ident, _) = arg.pat.node {
111+
if let PatKind::Binding(.., ident, _) = arg.pat.node {
112112
bindings.push((ident.name, ident.span))
113113
}
114114
}
@@ -172,7 +172,7 @@ fn check_pat<'a, 'tcx>(
172172
) {
173173
// TODO: match more stuff / destructuring
174174
match pat.node {
175-
PatKind::Binding(_, _, ident, ref inner) => {
175+
PatKind::Binding(.., ident, ref inner) => {
176176
let name = ident.name;
177177
if is_binding(cx, pat.hir_id) {
178178
let mut new_binding = true;

clippy_lints/src/slow_vector_initialization.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
9696
// Matches statements which initializes vectors. For example: `let mut vec = Vec::with_capacity(10)`
9797
if_chain! {
9898
if let StmtKind::Local(ref local) = stmt.node;
99-
if let PatKind::Binding(BindingAnnotation::Mutable, _, variable_name, None) = local.pat.node;
99+
if let PatKind::Binding(BindingAnnotation::Mutable, .., variable_name, None) = local.pat.node;
100100
if let Some(ref init) = local.init;
101101
if let Some(ref len_arg) = Self::is_vec_with_capacity(init);
102102

clippy_lints/src/swap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn check_manual_swap(cx: &LateContext<'_, '_>, block: &Block) {
7777
// let t = foo();
7878
if let StmtKind::Local(ref tmp) = w[0].node;
7979
if let Some(ref tmp_init) = tmp.init;
80-
if let PatKind::Binding(_, _, ident, None) = tmp.pat.node;
80+
if let PatKind::Binding(.., ident, None) = tmp.pat.node;
8181

8282
// foo() = bar();
8383
if let StmtKind::Semi(ref first) = w[1].node;

clippy_lints/src/utils/author.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
513513
let current = format!("{}.node", self.current);
514514
match pat.node {
515515
PatKind::Wild => println!("Wild = {};", current),
516-
PatKind::Binding(anno, _, ident, ref sub) => {
516+
PatKind::Binding(anno, .., ident, ref sub) => {
517517
let anno_pat = match anno {
518518
BindingAnnotation::Unannotated => "BindingAnnotation::Unannotated",
519519
BindingAnnotation::Mutable => "BindingAnnotation::Mutable",

clippy_lints/src/utils/hir_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
193193
(&PatKind::TupleStruct(ref lp, ref la, ls), &PatKind::TupleStruct(ref rp, ref ra, rs)) => {
194194
self.eq_qpath(lp, rp) && over(la, ra, |l, r| self.eq_pat(l, r)) && ls == rs
195195
},
196-
(&PatKind::Binding(ref lb, _, ref li, ref lp), &PatKind::Binding(ref rb, _, ref ri, ref rp)) => {
196+
(&PatKind::Binding(ref lb, .., ref li, ref lp), &PatKind::Binding(ref rb, .., ref ri, ref rp)) => {
197197
lb == rb && li.name.as_str() == ri.name.as_str() && both(lp, rp, |l, r| self.eq_pat(l, r))
198198
},
199199
(&PatKind::Path(ref l), &PatKind::Path(ref r)) => self.eq_qpath(l, r),

clippy_lints/src/utils/inspector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ fn print_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat, indent: usize) {
420420
println!("{}+", ind);
421421
match pat.node {
422422
hir::PatKind::Wild => println!("{}Wild", ind),
423-
hir::PatKind::Binding(ref mode, _, ident, ref inner) => {
423+
hir::PatKind::Binding(ref mode, .., ident, ref inner) => {
424424
println!("{}Binding", ind);
425425
println!("{}mode: {:?}", ind, mode);
426426
println!("{}name: {}", ind, ident.name);

clippy_lints/src/utils/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ pub fn get_item_name(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<Name> {
373373
/// Get the name of a `Pat`, if any
374374
pub fn get_pat_name(pat: &Pat) -> Option<Name> {
375375
match pat.node {
376-
PatKind::Binding(_, _, ref spname, _) => Some(spname.name),
376+
PatKind::Binding(.., ref spname, _) => Some(spname.name),
377377
PatKind::Path(ref qpath) => single_segment_path(qpath).map(|ps| ps.ident.name),
378378
PatKind::Box(ref p) | PatKind::Ref(ref p, _) => get_pat_name(&*p),
379379
_ => None,
@@ -1008,7 +1008,7 @@ pub fn opt_def_id(def: Def) -> Option<DefId> {
10081008
}
10091009

10101010
pub fn is_self(slf: &Arg) -> bool {
1011-
if let PatKind::Binding(_, _, name, _) = slf.pat.node {
1011+
if let PatKind::Binding(.., name, _) = slf.pat.node {
10121012
name.name == keywords::SelfLower.name()
10131013
} else {
10141014
false
@@ -1038,7 +1038,7 @@ pub fn is_try(expr: &Expr) -> Option<&Expr> {
10381038
if_chain! {
10391039
if let PatKind::TupleStruct(ref path, ref pat, None) = arm.pats[0].node;
10401040
if match_qpath(path, &paths::RESULT_OK[1..]);
1041-
if let PatKind::Binding(_, defid, _, None) = pat[0].node;
1041+
if let PatKind::Binding(_, defid, _, _, None) = pat[0].node;
10421042
if let ExprKind::Path(QPath::Resolved(None, ref path)) = arm.body.node;
10431043
if let Def::Local(lid) = path.def;
10441044
if lid == defid;
@@ -1087,7 +1087,7 @@ pub fn is_allowed(cx: &LateContext<'_, '_>, lint: &'static Lint, id: NodeId) ->
10871087

10881088
pub fn get_arg_name(pat: &Pat) -> Option<ast::Name> {
10891089
match pat.node {
1090-
PatKind::Binding(_, _, ident, None) => Some(ident.name),
1090+
PatKind::Binding(.., ident, None) => Some(ident.name),
10911091
PatKind::Ref(ref subpat, _) => get_arg_name(subpat),
10921092
_ => None,
10931093
}

0 commit comments

Comments
 (0)