We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ba7655 commit 36efb50Copy full SHA for 36efb50
vm/src/obj/objrange.rs
@@ -82,15 +82,15 @@ impl PyRange {
82
return None;
83
}
84
85
- let length = if start < stop {
+ let length: BigInt = if start < stop {
86
(stop - start - 1) / step + 1
87
} else {
88
(start - stop - 1) / (-step) + 1
89
};
90
91
- let index = if index < BigInt::zero() {
92
- let new_index = &length + &index;
93
- if new_index < BigInt::zero() {
+ let index = if index.is_negative() {
+ let new_index: BigInt = &length + &index;
+ if new_index.is_negative() {
94
95
96
length + index
0 commit comments