Skip to content

Commit

Permalink
Auto merge of #3591 - flip1995:rustup, r=phansch
Browse files Browse the repository at this point in the history
Match on ast/hir::ExprKind::Err

rustup #56999
  • Loading branch information
bors committed Dec 28, 2018
2 parents dfe1232 + 909bfd3 commit 32b3bc2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion clippy_lints/src/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,8 @@ fn never_loop_expr(expr: &Expr, main_loop_id: NodeId) -> NeverLoopResult {
| ExprKind::Closure(_, _, _, _, _)
| ExprKind::InlineAsm(_, _, _)
| ExprKind::Path(_)
| ExprKind::Lit(_) => NeverLoopResult::Otherwise,
| ExprKind::Lit(_)
| ExprKind::Err => NeverLoopResult::Otherwise,
}
}

Expand Down
3 changes: 3 additions & 0 deletions clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
self.current = value_pat;
self.visit_expr(value);
},
ExprKind::Err => {
println!("Err = {}", current);
},
}
}

Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/utils/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
self.hash_name(l.ident.name);
}
},
ExprKind::Err => {},
}
}

Expand Down
3 changes: 3 additions & 0 deletions clippy_lints/src/utils/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
println!("{}repeat count:", ind);
print_expr(cx, &cx.tcx.hir().body(anon_const.body).value, indent + 1);
},
hir::ExprKind::Err => {
println!("{}Err", ind);
},
}
}

Expand Down
6 changes: 4 additions & 2 deletions clippy_lints/src/utils/sugg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ impl<'a> Sugg<'a> {
| hir::ExprKind::Ret(..)
| hir::ExprKind::Struct(..)
| hir::ExprKind::Tup(..)
| hir::ExprKind::While(..) => Sugg::NonParen(snippet),
| hir::ExprKind::While(..)
| hir::ExprKind::Err => Sugg::NonParen(snippet),
hir::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
hir::ExprKind::AssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet),
hir::ExprKind::Binary(op, ..) => Sugg::BinOp(AssocOp::from_ast_binop(higher::binop(op.node)), snippet),
Expand Down Expand Up @@ -158,7 +159,8 @@ impl<'a> Sugg<'a> {
| ast::ExprKind::Tup(..)
| ast::ExprKind::Array(..)
| ast::ExprKind::While(..)
| ast::ExprKind::WhileLet(..) => Sugg::NonParen(snippet),
| ast::ExprKind::WhileLet(..)
| ast::ExprKind::Err => Sugg::NonParen(snippet),
ast::ExprKind::Range(.., RangeLimits::HalfOpen) => Sugg::BinOp(AssocOp::DotDot, snippet),
ast::ExprKind::Range(.., RangeLimits::Closed) => Sugg::BinOp(AssocOp::DotDotEq, snippet),
ast::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
Expand Down

0 comments on commit 32b3bc2

Please sign in to comment.