Skip to content

Commit 8f840d5

Browse files
committed
Pick code review nits.
1 parent 9a92159 commit 8f840d5

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

vm/src/obj/objdict.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -237,34 +237,34 @@ impl ItemProtocol for PyDictRef {
237237
// Implement IntoIterator so that we can easily iterate dictionaries from rust code.
238238
impl IntoIterator for PyDictRef {
239239
type Item = (PyObjectRef, PyObjectRef);
240-
type IntoIter = DictIterator;
240+
type IntoIter = DictIter;
241241

242242
fn into_iter(self) -> Self::IntoIter {
243-
DictIterator::new(self)
243+
DictIter::new(self)
244244
}
245245
}
246246

247247
impl IntoIterator for &PyDictRef {
248248
type Item = (PyObjectRef, PyObjectRef);
249-
type IntoIter = DictIterator;
249+
type IntoIter = DictIter;
250250

251251
fn into_iter(self) -> Self::IntoIter {
252-
DictIterator::new(self.clone())
252+
DictIter::new(self.clone())
253253
}
254254
}
255255

256-
pub struct DictIterator {
256+
pub struct DictIter {
257257
dict: PyDictRef,
258258
position: usize,
259259
}
260260

261-
impl DictIterator {
262-
pub fn new(dict: PyDictRef) -> DictIterator {
263-
DictIterator { dict, position: 0 }
261+
impl DictIter {
262+
pub fn new(dict: PyDictRef) -> DictIter {
263+
DictIter { dict, position: 0 }
264264
}
265265
}
266266

267-
impl Iterator for DictIterator {
267+
impl Iterator for DictIter {
268268
type Item = (PyObjectRef, PyObjectRef);
269269

270270
fn next(&mut self) -> Option<Self::Item> {

vm/src/obj/objobject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub fn get_attributes(obj: &PyObjectRef) -> PyAttributes {
237237

238238
// Get instance attributes:
239239
if let Some(dict) = &obj.dict {
240-
for (key, value) in dict.into_iter() {
240+
for (key, value) in dict {
241241
attributes.insert(key.to_string(), value.clone());
242242
}
243243
}

vm/src/stdlib/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<'s> serde::Serialize for PyObjectSerializer<'s> {
6464
serialize_seq_elements(serializer, &elements)
6565
} else if objtype::isinstance(self.pyobject, &self.vm.ctx.dict_type()) {
6666
let dict: PyDictRef = self.pyobject.clone().downcast().unwrap();
67-
let pairs: Vec<(PyObjectRef, PyObjectRef)> = dict.into_iter().collect();
67+
let pairs: Vec<_> = dict.into_iter().collect();
6868
let mut map = serializer.serialize_map(Some(pairs.len()))?;
6969
for (key, e) in pairs.iter() {
7070
map.serialize_entry(&self.clone_with_object(key), &self.clone_with_object(&e))?;

0 commit comments

Comments
 (0)