Skip to content

Fix compilation for nightly 2018-04-15 #2670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from Apr 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion clippy_lints/src/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 0 additions & 2 deletions clippy_lints/src/no_effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -143,7 +142,6 @@ fn reduce_expression<'a>(cx: &LateContext, expr: &'a Expr) -> Option<Vec<&'a Exp
Expr_::ExprType(ref inner, _) |
Expr_::ExprUnary(_, ref inner) |
Expr_::ExprField(ref inner, _) |
Expr_::ExprTupField(ref inner, _) |
Expr_::ExprAddrOf(_, ref inner) |
Expr_::ExprBox(ref inner) => reduce_expression(cx, inner).or_else(|| Some(vec![inner])),
Expr_::ExprStruct(_, ref fields, ref base) => if has_drop(cx, expr) {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
9 changes: 4 additions & 5 deletions clippy_lints/src/temporary_assignment.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -40,11 +40,10 @@ impl LintPass for Pass {
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) {
if let ExprField(ref base, _) = target.node {
if is_temporary(base) && !is_adjusted(cx, base) {
span_lint(cx, TEMPORARY_ASSIGNMENT, expr.span, "assignment to temporary");
},
_ => (),
}
}
}
}
Expand Down
8 changes: 0 additions & 8 deletions clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 0 additions & 8 deletions clippy_lints/src/utils/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) => {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions clippy_lints/src/utils/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions clippy_lints/src/utils/sugg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down