mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
fetch_instruction can just return a reference.
This commit is contained in:
1 parent
b0ee1947c7
commit
786eb2cbfb
1 file changed
+2
-4
+2
-4
@@ -141,10 +141,8 @@ impl Frame {
|
||||
value
|
||||
}
|
||||
|
||||
pub fn fetch_instruction(&self) -> bytecode::Instruction {
|
||||
// TODO: an immutable reference is enough, we should not
|
||||
// clone the instruction.
|
||||
let ins2 = self.code.instructions[*self.lasti.borrow()].clone();
|
||||
pub fn fetch_instruction(&self) -> &bytecode::Instruction {
|
||||
let ins2 = &self.code.instructions[*self.lasti.borrow()];
|
||||
*self.lasti.borrow_mut() += 1;
|
||||
ins2
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user