Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkuu committed Mar 25, 2018
1 parent 9b8e000 commit 8aa55e7
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/libsyntax_ext/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,8 @@ impl<'cx, 'a: 'cx> Context<'cx, 'a> {

match expr.node {
CondExprKind::BinOp(op, left, right) => {
let left_by_ref = if let CondExprKind::Capture(.., mode) = left.node {
mode.is_by_ref()
} else {
false
};
let right_by_ref = if let CondExprKind::Capture(.., mode) = right.node {
mode.is_by_ref()
} else {
false
};
let left_by_ref = left.is_by_ref_capture();
let right_by_ref = right.is_by_ref_capture();

let with_left = Action::Value(Rc::new(move |left, is_evaluated| {
let action = action.clone();
Expand Down Expand Up @@ -663,6 +655,13 @@ impl CondExpr {
matches!(self.node, CondExprKind::Capture(..))
}

fn is_by_ref_capture(&self) -> bool {
matches!(
self.node,
CondExprKind::Capture(_, _, BindingMode::ByRef(_))
)
}

fn is_lazy_binop(&self) -> bool {
if let CondExprKind::BinOp(op, ..) = self.node {
op.lazy()
Expand Down

0 comments on commit 8aa55e7

Please sign in to comment.