Skip to content

Commit

Permalink
fix positive integer
Browse files Browse the repository at this point in the history
  • Loading branch information
diceroll123 committed Jan 21, 2024
1 parent 6ba0c85 commit e23bb9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub(crate) fn potential_index_error(checker: &mut Checker, value: &Expr, slice:
value: ast::Number::Int(number_value),
range,
}) => match number_value.as_i64() {
Some(value) => (-value, *range),
Some(value) => (value, *range),
None => return,
},
Expr::UnaryOp(ast::ExprUnaryOp {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
---
source: crates/ruff_linter/src/rules/pylint/mod.rs
---
potential_index_error.py:1:17: PLE0643 Potential IndexError
|
1 | print([1, 2, 3][3]) # PLE0643
| ^ PLE0643
2 | print([1, 2, 3][-4]) # PLE0643
3 | print([1, 2, 3][9223372036854775807]) # PLE0643
|

potential_index_error.py:2:17: PLE0643 Potential IndexError
|
1 | print([1, 2, 3][3]) # PLE0643
Expand Down

0 comments on commit e23bb9d

Please sign in to comment.