From a9c8d1bd906c30b1c491801e9063c400c378db0b Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Sun, 15 Apr 2018 04:48:14 +0200 Subject: [PATCH] Fix compilation for nightly 2018-04-15 This only fixes compilation and the build. It's possible that the `author` and `inspector` lints are broken but there are no failing tests. Closes #2667 --- clippy_lints/src/loops.rs | 1 - clippy_lints/src/no_effect.rs | 2 -- clippy_lints/src/shadow.rs | 2 +- clippy_lints/src/temporary_assignment.rs | 4 ++-- clippy_lints/src/utils/author.rs | 8 -------- clippy_lints/src/utils/hir_utils.rs | 8 -------- clippy_lints/src/utils/inspector.rs | 6 ------ clippy_lints/src/utils/sugg.rs | 2 -- 8 files changed, 3 insertions(+), 30 deletions(-) diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 561940f9e..cfef1e85b 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -602,7 +602,6 @@ fn never_loop_expr(expr: &Expr, main_loop_id: &NodeId) -> NeverLoopResult { ExprCast(ref e, _) | ExprType(ref e, _) | ExprField(ref e, _) | - ExprTupField(ref e, _) | ExprAddrOf(_, ref e) | ExprStruct(_, _, Some(ref e)) | ExprRepeat(ref e, _) => never_loop_expr(e, main_loop_id), diff --git a/clippy_lints/src/no_effect.rs b/clippy_lints/src/no_effect.rs index 184776141..2765c1b2e 100644 --- a/clippy_lints/src/no_effect.rs +++ b/clippy_lints/src/no_effect.rs @@ -56,7 +56,6 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool { Expr_::ExprType(ref inner, _) | Expr_::ExprUnary(_, ref inner) | Expr_::ExprField(ref inner, _) | - Expr_::ExprTupField(ref inner, _) | Expr_::ExprAddrOf(_, ref inner) | Expr_::ExprBox(ref inner) => has_no_effect(cx, inner), Expr_::ExprStruct(_, ref fields, ref base) => { @@ -143,7 +142,6 @@ fn reduce_expression<'a>(cx: &LateContext, expr: &'a Expr) -> Option reduce_expression(cx, inner).or_else(|| Some(vec![inner])), Expr_::ExprStruct(_, ref fields, ref base) => if has_drop(cx, expr) { diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index 8330bb701..b7e79a063 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -306,7 +306,7 @@ fn check_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, bindings: return; } match expr.node { - ExprUnary(_, ref e) | ExprField(ref e, _) | ExprTupField(ref e, _) | ExprAddrOf(_, ref e) | ExprBox(ref e) => { + ExprUnary(_, ref e) | ExprField(ref e, _) | ExprAddrOf(_, ref e) | ExprBox(ref e) => { check_expr(cx, e, bindings) }, ExprBlock(ref block) | ExprLoop(ref block, _, _) => check_block(cx, block, bindings), diff --git a/clippy_lints/src/temporary_assignment.rs b/clippy_lints/src/temporary_assignment.rs index 459549f1e..49f079f8c 100644 --- a/clippy_lints/src/temporary_assignment.rs +++ b/clippy_lints/src/temporary_assignment.rs @@ -1,5 +1,5 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::hir::{Expr, ExprAssign, ExprField, ExprStruct, ExprTup, ExprTupField}; +use rustc::hir::{Expr, ExprAssign, ExprField, ExprStruct, ExprTup}; use utils::is_adjusted; use utils::span_lint; @@ -41,7 +41,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprAssign(ref target, _) = expr.node { match target.node { - ExprField(ref base, _) | ExprTupField(ref base, _) => if is_temporary(base) && !is_adjusted(cx, base) { + ExprField(ref base, _) => if is_temporary(base) && !is_adjusted(cx, base) { span_lint(cx, TEMPORARY_ASSIGNMENT, expr.span, "assignment to temporary"); }, _ => (), diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index 7aeaa7104..8e81d9440 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -371,14 +371,6 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor { self.current = obj_pat; self.visit_expr(object); }, - Expr_::ExprTupField(ref object, ref field_id) => { - let obj_pat = self.next("object"); - let field_id_pat = self.next("field_id"); - println!("TupField(ref {}, ref {}) = {};", obj_pat, field_id_pat, current); - println!(" if {}.node == {}", field_id_pat, field_id.node); - self.current = obj_pat; - self.visit_expr(object); - }, Expr_::ExprIndex(ref object, ref index) => { let object_pat = self.next("object"); let index_pat = self.next("index"); diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index 1f96ec2b2..780d8339c 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -131,7 +131,6 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { && over(lf, rf, |l, r| self.eq_field(l, r)) }, (&ExprTup(ref l_tup), &ExprTup(ref r_tup)) => self.eq_exprs(l_tup, r_tup), - (&ExprTupField(ref le, li), &ExprTupField(ref re, ri)) => li.node == ri.node && self.eq_expr(le, re), (&ExprUnary(l_op, ref le), &ExprUnary(r_op, ref re)) => l_op == r_op && self.eq_expr(le, re), (&ExprArray(ref l), &ExprArray(ref r)) => self.eq_exprs(l, r), (&ExprWhile(ref lc, ref lb, ref ll), &ExprWhile(ref rc, ref rb, ref rl)) => { @@ -496,13 +495,6 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> { c.hash(&mut self.s); self.hash_exprs(tup); }, - ExprTupField(ref le, li) => { - let c: fn(_, _) -> _ = ExprTupField; - c.hash(&mut self.s); - - self.hash_expr(le); - li.node.hash(&mut self.s); - }, ExprType(ref e, ref _ty) => { let c: fn(_, _) -> _ = ExprType; c.hash(&mut self.s); diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index e8d07fbed..ac38227c3 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -274,12 +274,6 @@ fn print_expr(cx: &LateContext, expr: &hir::Expr, indent: usize) { println!("{}struct expr:", ind); print_expr(cx, e, indent + 1); }, - hir::ExprTupField(ref e, ref idx) => { - println!("{}TupField", ind); - println!("{}field index: {}", ind, idx.node); - println!("{}tuple expr:", ind); - print_expr(cx, e, indent + 1); - }, hir::ExprIndex(ref arr, ref idx) => { println!("{}Index", ind); println!("{}array expr:", ind); diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index 526cadb43..a9e5a3222 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -69,7 +69,6 @@ impl<'a> Sugg<'a> { hir::ExprRet(..) | hir::ExprStruct(..) | hir::ExprTup(..) | - hir::ExprTupField(..) | hir::ExprWhile(..) => Sugg::NonParen(snippet), hir::ExprAssign(..) => Sugg::BinOp(AssocOp::Assign, snippet), hir::ExprAssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet), @@ -121,7 +120,6 @@ impl<'a> Sugg<'a> { ast::ExprKind::Struct(..) | ast::ExprKind::Try(..) | ast::ExprKind::Tup(..) | - ast::ExprKind::TupField(..) | ast::ExprKind::Array(..) | ast::ExprKind::While(..) | ast::ExprKind::WhileLet(..) => Sugg::NonParen(snippet),