mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-16 09:48:08 +00:00
Auto merge of #4056 - matthiaskrgr:rustup__, r=Manishearth
more Use->DropTemps fixes changelog: none
This commit is contained in:
commit
2ed0b3bfa0
6 changed files with 10 additions and 10 deletions
|
@ -677,7 +677,7 @@ fn never_loop_expr(expr: &Expr, main_loop_id: HirId) -> NeverLoopResult {
|
||||||
| ExprKind::AddrOf(_, ref e)
|
| ExprKind::AddrOf(_, ref e)
|
||||||
| ExprKind::Struct(_, _, Some(ref e))
|
| ExprKind::Struct(_, _, Some(ref e))
|
||||||
| ExprKind::Repeat(ref e, _)
|
| ExprKind::Repeat(ref e, _)
|
||||||
| ExprKind::Use(ref e) => never_loop_expr(e, main_loop_id),
|
| ExprKind::DropTemps(ref e) => never_loop_expr(e, main_loop_id),
|
||||||
ExprKind::Array(ref es) | ExprKind::MethodCall(_, _, ref es) | ExprKind::Tup(ref es) => {
|
ExprKind::Array(ref es) | ExprKind::MethodCall(_, _, ref es) | ExprKind::Tup(ref es) => {
|
||||||
never_loop_expr_all(&mut es.iter(), main_loop_id)
|
never_loop_expr_all(&mut es.iter(), main_loop_id)
|
||||||
},
|
},
|
||||||
|
|
|
@ -495,9 +495,9 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
|
||||||
ExprKind::Err => {
|
ExprKind::Err => {
|
||||||
println!("Err = {}", current);
|
println!("Err = {}", current);
|
||||||
},
|
},
|
||||||
ExprKind::Use(ref expr) => {
|
ExprKind::DropTemps(ref expr) => {
|
||||||
let expr_pat = self.next("expr");
|
let expr_pat = self.next("expr");
|
||||||
println!("Use(ref {}) = {};", expr_pat, current);
|
println!("DropTemps(ref {}) = {};", expr_pat, current);
|
||||||
self.current = expr_pat;
|
self.current = expr_pat;
|
||||||
self.visit_expr(expr);
|
self.visit_expr(expr);
|
||||||
},
|
},
|
||||||
|
|
|
@ -156,7 +156,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
|
||||||
&& self.eq_block(lb, rb)
|
&& self.eq_block(lb, rb)
|
||||||
&& both(ll, rl, |l, r| l.ident.as_str() == r.ident.as_str())
|
&& both(ll, rl, |l, r| l.ident.as_str() == r.ident.as_str())
|
||||||
},
|
},
|
||||||
(&ExprKind::Use(ref le), &ExprKind::Use(ref re)) => self.eq_expr(le, re),
|
(&ExprKind::DropTemps(ref le), &ExprKind::DropTemps(ref re)) => self.eq_expr(le, re),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,8 +607,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ExprKind::Err => {},
|
ExprKind::Err => {},
|
||||||
ExprKind::Use(ref e) => {
|
ExprKind::DropTemps(ref e) => {
|
||||||
let c: fn(_) -> _ = ExprKind::Use;
|
let c: fn(_) -> _ = ExprKind::DropTemps;
|
||||||
c.hash(&mut self.s);
|
c.hash(&mut self.s);
|
||||||
self.hash_expr(e);
|
self.hash_expr(e);
|
||||||
},
|
},
|
||||||
|
|
|
@ -330,8 +330,8 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
|
||||||
hir::ExprKind::Err => {
|
hir::ExprKind::Err => {
|
||||||
println!("{}Err", ind);
|
println!("{}Err", ind);
|
||||||
},
|
},
|
||||||
hir::ExprKind::Use(ref e) => {
|
hir::ExprKind::DropTemps(ref e) => {
|
||||||
println!("{}Use", ind);
|
println!("{}DropTemps", ind);
|
||||||
print_expr(cx, e, indent + 1);
|
print_expr(cx, e, indent + 1);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ impl<'a> Sugg<'a> {
|
||||||
| hir::ExprKind::Struct(..)
|
| hir::ExprKind::Struct(..)
|
||||||
| hir::ExprKind::Tup(..)
|
| hir::ExprKind::Tup(..)
|
||||||
| hir::ExprKind::While(..)
|
| hir::ExprKind::While(..)
|
||||||
| hir::ExprKind::Use(_)
|
| hir::ExprKind::DropTemps(_)
|
||||||
| hir::ExprKind::Err => Sugg::NonParen(snippet),
|
| hir::ExprKind::Err => Sugg::NonParen(snippet),
|
||||||
hir::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
|
hir::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
|
||||||
hir::ExprKind::AssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet),
|
hir::ExprKind::AssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let ExprKind::Use(ref expr) = expr.node;
|
if let ExprKind::DropTemps(ref expr) = expr.node;
|
||||||
if let ExprKind::Match(ref expr1, ref arms, MatchSource::ForLoopDesugar) = expr.node;
|
if let ExprKind::Match(ref expr1, ref arms, MatchSource::ForLoopDesugar) = expr.node;
|
||||||
if let ExprKind::Call(ref func, ref args) = expr1.node;
|
if let ExprKind::Call(ref func, ref args) = expr1.node;
|
||||||
if let ExprKind::Path(ref path) = func.node;
|
if let ExprKind::Path(ref path) = func.node;
|
||||||
|
|
Loading…
Reference in a new issue