Skip to content

Commit 57029f6

Browse files
authored
Derive Default for GroupByState (RustPython#6043)
1 parent d8f1d18 commit 57029f6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

vm/src/stdlib/itertools.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ mod decl {
666666
}
667667
}
668668

669+
#[derive(Default)]
669670
struct GroupByState {
670671
current_value: Option<PyObjectRef>,
671672
current_key: Option<PyObjectRef>,
@@ -729,12 +730,7 @@ mod decl {
729730
Self {
730731
iterable,
731732
key_func: key.flatten(),
732-
state: PyMutex::new(GroupByState {
733-
current_key: None,
734-
current_value: None,
735-
next_group: false,
736-
grouper: None,
737-
}),
733+
state: PyMutex::new(GroupByState::default()),
738734
}
739735
.into_ref_with_type(vm, cls)
740736
.map(Into::into)

0 commit comments

Comments
 (0)