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
This commit is contained in:
parent
fc8e35884b
commit
a9c8d1bd90
|
@ -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),
|
||||
|
|
|
@ -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<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) {
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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");
|
||||
},
|
||||
_ => (),
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue