mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Simplify PyDictRef.__repr__.
This commit is contained in:
@@ -89,7 +89,7 @@ impl PyDictRef {
|
||||
self.entries.borrow().len()
|
||||
}
|
||||
|
||||
fn repr(self, vm: &VirtualMachine) -> PyResult {
|
||||
fn repr(self, vm: &VirtualMachine) -> PyResult<String> {
|
||||
let s = if let Some(_guard) = ReprGuard::enter(self.as_object()) {
|
||||
let mut str_parts = vec![];
|
||||
for (key, value) in self.get_key_value_pairs() {
|
||||
@@ -102,7 +102,7 @@ impl PyDictRef {
|
||||
} else {
|
||||
"{...}".to_string()
|
||||
};
|
||||
Ok(vm.new_str(s))
|
||||
Ok(s)
|
||||
}
|
||||
|
||||
fn contains(self, key: PyObjectRef, vm: &VirtualMachine) -> PyResult<bool> {
|
||||
|
||||
Reference in New Issue
Block a user