File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -292,14 +292,12 @@ fn range_getitem(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
292
292
let range = get_value ( zelf) ;
293
293
294
294
if let Some ( i) = subscript. payload :: < PyInt > ( ) {
295
- return if let Some ( int) = range. get ( i. value . clone ( ) ) {
295
+ if let Some ( int) = range. get ( i. value . clone ( ) ) {
296
296
Ok ( vm. ctx . new_int ( int) )
297
297
} else {
298
298
Err ( vm. new_index_error ( "range object index out of range" . to_string ( ) ) )
299
- } ;
300
- }
301
-
302
- if let Some ( PySlice {
299
+ }
300
+ } else if let Some ( PySlice {
303
301
ref start,
304
302
ref stop,
305
303
ref step,
@@ -331,7 +329,7 @@ fn range_getitem(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
331
329
range. step
332
330
} ;
333
331
334
- return Ok ( PyObject :: new (
332
+ Ok ( PyObject :: new (
335
333
PyObjectPayload :: AnyRustValue {
336
334
value : Box :: new ( PyRange {
337
335
start : new_start,
@@ -340,10 +338,10 @@ fn range_getitem(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
340
338
} ) ,
341
339
} ,
342
340
vm. ctx . range_type ( ) ,
343
- ) ) ;
341
+ ) )
342
+ } else {
343
+ Err ( vm. new_type_error ( "range indices must be integer or slice" . to_string ( ) ) )
344
344
}
345
-
346
- Err ( vm. new_type_error ( "range indices must be integer or slice" . to_string ( ) ) )
347
345
}
348
346
349
347
fn range_repr ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
You can’t perform that action at this time.
0 commit comments