Skip to content

more Use->DropTemps fixes #4056

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
May 1, 2019
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
2 changes: 1 addition & 1 deletion clippy_lints/src/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ fn never_loop_expr(expr: &Expr, main_loop_id: HirId) -> NeverLoopResult {
| ExprKind::AddrOf(_, ref e)
| ExprKind::Struct(_, _, Some(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) => {
never_loop_expr_all(&mut es.iter(), main_loop_id)
},
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,9 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
ExprKind::Err => {
println!("Err = {}", current);
},
ExprKind::Use(ref expr) => {
ExprKind::DropTemps(ref expr) => {
let expr_pat = self.next("expr");
println!("Use(ref {}) = {};", expr_pat, current);
println!("DropTemps(ref {}) = {};", expr_pat, current);
self.current = expr_pat;
self.visit_expr(expr);
},
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/utils/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
&& self.eq_block(lb, rb)
&& 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,
}
}
Expand Down Expand Up @@ -607,8 +607,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
}
},
ExprKind::Err => {},
ExprKind::Use(ref e) => {
let c: fn(_) -> _ = ExprKind::Use;
ExprKind::DropTemps(ref e) => {
let c: fn(_) -> _ = ExprKind::DropTemps;
c.hash(&mut self.s);
self.hash_expr(e);
},
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/utils/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
hir::ExprKind::Err => {
println!("{}Err", ind);
},
hir::ExprKind::Use(ref e) => {
println!("{}Use", ind);
hir::ExprKind::DropTemps(ref e) => {
println!("{}DropTemps", ind);
print_expr(cx, e, indent + 1);
},
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/sugg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<'a> Sugg<'a> {
| hir::ExprKind::Struct(..)
| hir::ExprKind::Tup(..)
| hir::ExprKind::While(..)
| hir::ExprKind::Use(_)
| hir::ExprKind::DropTemps(_)
| hir::ExprKind::Err => Sugg::NonParen(snippet),
hir::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
hir::ExprKind::AssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet),
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/author/for_loop.stdout
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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::Call(ref func, ref args) = expr1.node;
if let ExprKind::Path(ref path) = func.node;
Expand Down