Skip to content

Commit 06c128f

Browse files
committed
Eleminate cast if src and dest types are the same
1 parent d87afb0 commit 06c128f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/gitql-parser/src/parse_cast.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ fn cast_expression_or_error(
8484

8585
// Check if it's supported to cast this value to result type, just return CastExpr
8686
let value_type: Box<dyn DataType> = expr.expr_type();
87+
if value_type.equals(&target_type) {
88+
return Ok(expr);
89+
}
90+
8791
let value_expected_types = value_type.can_perform_explicit_cast_op_to();
8892
if value_expected_types.contains(&target_type) {
8993
return Ok(Box::new(CastExpr {

0 commit comments

Comments
 (0)