Skip to content

Commit 58369b6

Browse files
committed
Delete unnessesary code from dict.clear
1 parent 85110f6 commit 58369b6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

vm/src/obj/objdict.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,8 @@ fn dict_delitem(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
246246

247247
fn dict_clear(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
248248
arg_check!(vm, args, required = [(dict, Some(vm.ctx.dict_type()))]);
249-
let mut mut_obj = dict.borrow_mut();
250-
match mut_obj.payload {
251-
PyObjectPayload::Dict { ref mut elements } => {
252-
elements.clear();
253-
Ok(vm.get_none())
254-
}
255-
_ => Err(vm.new_type_error("".to_string())),
256-
}
249+
get_mut_elements(dict).clear();
250+
Ok(vm.get_none())
257251
}
258252

259253
/// When iterating over a dictionary, we iterate over the keys of it.

0 commit comments

Comments
 (0)