Skip to content

Commit 1f9eae6

Browse files
philippeitisphilippeitis
authored andcommitted
Add vm to imul signature, fix return type, formatting fixes.
1 parent 822badd commit 1f9eae6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

vm/src/obj/objlist.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ impl PyList {
477477
.collect();
478478
return Ok(vm.ctx.new_list(new_elements));
479479
}
480-
return Err(vm.new_memory_error("".to_owned()));
480+
Err(vm.new_memory_error("".to_owned()))
481481
}
482482

483483
#[pymethod(name = "__rmul__")]
@@ -486,15 +486,15 @@ impl PyList {
486486
}
487487

488488
#[pymethod(name = "__imul__")]
489-
fn imul(zelf: PyRef<Self>, counter: isize) -> PyResult<Self> {
489+
fn imul(zelf: PyRef<Self>, counter: isize, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
490490
if counter < 0 || zelf.len() * (counter as usize) < MAX_MEMORY_SIZE {
491491
let new_elements = sequence::seq_mul(&zelf.borrow_sequence(), counter)
492492
.cloned()
493493
.collect();
494494
zelf.elements.replace(new_elements);
495-
return Ok(*zelf);
495+
return Ok(zelf);
496496
}
497-
return Err(vm.new_memory_error("".to_owned()));
497+
Err(vm.new_memory_error("".to_owned()))
498498
}
499499

500500
#[pymethod]

vm/src/obj/objstr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl PyString {
337337
vm.new_overflow_error("cannot fit 'int' into an index-sized integer".to_owned())
338338
});
339339
}
340-
return Err(vm.new_memory_error("".to_owned()));
340+
Err(vm.new_memory_error("".to_owned()))
341341
}
342342

343343
#[pymethod(name = "__rmul__")]

0 commit comments

Comments
 (0)