mirror of https://github.com/rust-lang/rust.git
Small refactor of mutable_debug_assertions
This commit is contained in:
parent
fa046d2e7f
commit
2c4df2418c
|
@ -61,16 +61,18 @@ fn extract_call<'a, 'tcx>(cx: &'a LateContext<'a, 'tcx>, e: &'tcx Expr<'_>) -> O
|
|||
if block.stmts.len() == 1;
|
||||
if let StmtKind::Semi(ref matchexpr) = block.stmts[0].kind;
|
||||
then {
|
||||
// debug_assert
|
||||
if_chain! {
|
||||
if let ExprKind::Match(ref ifclause, _, _) = matchexpr.kind;
|
||||
if let ExprKind::DropTemps(ref droptmp) = ifclause.kind;
|
||||
if let ExprKind::Unary(UnOp::UnNot, ref condition) = droptmp.kind;
|
||||
then {
|
||||
// debug_assert
|
||||
let mut visitor = MutArgVisitor::new(cx);
|
||||
visitor.visit_expr(condition);
|
||||
return visitor.expr_span();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
// debug_assert_{eq,ne}
|
||||
if_chain! {
|
||||
if let ExprKind::Block(ref matchblock, _) = matchexpr.kind;
|
||||
|
@ -97,8 +99,6 @@ fn extract_call<'a, 'tcx>(cx: &'a LateContext<'a, 'tcx>, e: &'tcx Expr<'_>) -> O
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue