Skip to content

Commit 08fa3ae

Browse files
ankddevlpil
authored andcommitted
Raise inefficient 'list.length' usage warning in more cases
Signed-off-by: Andrey <[email protected]>
1 parent 9b143bb commit 08fa3ae

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler-core/src/type_/expression.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4774,10 +4774,11 @@ fn get_empty_list_check_kind<'a>(
47744774
}
47754775
(_, TypedExpr::Int { value, .. }) => match (binop, value.as_str()) {
47764776
(BinOp::LtEqInt, "0" | "-0") | (BinOp::LtInt, "1") => Some(EmptyListCheckKind::Empty),
4777+
(BinOp::GtInt, "0" | "-0") => Some(EmptyListCheckKind::NonEmpty),
47774778
_ => None,
47784779
},
47794780
(TypedExpr::Int { value, .. }, _) => match (binop, value.as_str()) {
4780-
(BinOp::GtEqInt, "0" | "-0") | (BinOp::GtInt, "1") => {
4781+
(BinOp::GtEqInt, "0" | "-0") | (BinOp::GtInt, "1") | (BinOp::LtInt, "0" | "-0") => {
47814782
Some(EmptyListCheckKind::NonEmpty)
47824783
}
47834784
_ => None,

0 commit comments

Comments
 (0)