Skip to content

Commit a2c7998

Browse files
committed
Fix parens
1 parent d73a86a commit a2c7998

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

cpp2rust/converter/converter_lib.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -782,12 +782,16 @@ std::optional<clang::QualType>
782782
GetOperandImplicitConversionTarget(const clang::BinaryOperator *op,
783783
const clang::Expr *operand,
784784
const clang::Expr *sibling) {
785-
bool same_type_op = op->isComparisonOp() || op->isAdditiveOp() ||
786-
op->isMultiplicativeOp() || op->isBitwiseOp();
787-
if (same_type_op &&
788-
NeedsImplicitScalarCast(operand->getType(), sibling->getType()) &&
789-
IsSizeType(sibling->getType())) {
790-
return sibling->getType();
785+
if (op->isComparisonOp()) {
786+
if (NeedsImplicitScalarCast(operand->getType(), sibling->getType()) &&
787+
IsSizeType(sibling->getType())) {
788+
return sibling->getType();
789+
}
790+
return std::nullopt;
791+
}
792+
if ((op->isAdditiveOp() || op->isMultiplicativeOp() || op->isBitwiseOp()) &&
793+
NeedsImplicitScalarCast(operand->getType(), op->getType())) {
794+
return op->getType();
791795
}
792796
return std::nullopt;
793797
}

0 commit comments

Comments
 (0)