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 56e2d4c commit e51c75eCopy full SHA for e51c75e
vm/src/obj/objsequence.rs
@@ -49,7 +49,7 @@ pub trait PySliceableSequence {
49
let stop = stop
50
.as_ref()
51
.map(|x| self.get_slice_pos(x))
52
- .unwrap_or(self.len());
+ .unwrap_or_else(|| self.len());
53
54
start..stop
55
}
@@ -65,7 +65,7 @@ pub trait PySliceableSequence {
65
// TODO: we could potentially avoid this copy and use slice
66
match &(slice.borrow()).payload {
67
PyObjectPayload::Slice { start, stop, step } => {
68
- let step = step.clone().unwrap_or(BigInt::one());
+ let step = step.clone().unwrap_or_else(BigInt::one);
69
if step.is_zero() {
70
Err(vm.new_value_error("slice step cannot be zero".to_string()))
71
} else if step.is_positive() {
0 commit comments