Skip to content

Commit 6a3e38d

Browse files
committed
Cargo Format
1 parent ecb3cd4 commit 6a3e38d

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

vm/src/obj/objrange.rs

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,16 @@ impl PyRange {
335335
};
336336

337337
let negative_step = substep.is_negative();
338-
let lower_bound = if negative_step { -BigInt::one() } else { BigInt::zero() };
339-
let upper_bound = if negative_step { &lower_bound + range_length } else { range_length.clone() };
338+
let lower_bound = if negative_step {
339+
-BigInt::one()
340+
} else {
341+
BigInt::zero()
342+
};
343+
let upper_bound = if negative_step {
344+
&lower_bound + range_length
345+
} else {
346+
range_length.clone()
347+
};
340348

341349
let substart = if let Some(slice_start) = slice.start_index(vm)? {
342350
if slice_start.is_negative() {
@@ -354,7 +362,11 @@ impl PyRange {
354362
}
355363
}
356364
} else {
357-
if negative_step { upper_bound.clone() } else { lower_bound.clone() }
365+
if negative_step {
366+
upper_bound.clone()
367+
} else {
368+
lower_bound.clone()
369+
}
358370
};
359371

360372
let substop = if let Some(slice_stop) = slice.stop_index(vm)? {
@@ -373,7 +385,11 @@ impl PyRange {
373385
}
374386
}
375387
} else {
376-
if negative_step { lower_bound.clone() } else { upper_bound.clone() }
388+
if negative_step {
389+
lower_bound.clone()
390+
} else {
391+
upper_bound.clone()
392+
}
377393
};
378394

379395
let step = range_step * &substep;
@@ -388,12 +404,10 @@ impl PyRange {
388404
.into_ref(vm)
389405
.into_object())
390406
}
391-
RangeIndex::Int(index) => {
392-
match self.get(index.as_bigint()) {
393-
Some(value) => Ok(PyInt::new(value).into_ref(vm).into_object()),
394-
None => Err(vm.new_index_error("range object index out of range".to_string()))
395-
}
396-
}
407+
RangeIndex::Int(index) => match self.get(index.as_bigint()) {
408+
Some(value) => Ok(PyInt::new(value).into_ref(vm).into_object()),
409+
None => Err(vm.new_index_error("range object index out of range".to_string())),
410+
},
397411
}
398412
}
399413

0 commit comments

Comments
 (0)