Skip to content

Commit e71020e

Browse files
committed
Fix take impl on RuntimeFixedList
1 parent 13f9bba commit e71020e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

consensus/types/src/runtime_var_list.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ pub struct RuntimeFixedList<T> {
253253
len: usize,
254254
}
255255

256-
impl<T: Clone> RuntimeFixedList<T> {
256+
impl<T: Clone + Default> RuntimeFixedList<T> {
257257
pub fn new(vec: Vec<T>) -> Self {
258258
let len = vec.len();
259259
Self { vec, len }
@@ -277,6 +277,7 @@ impl<T: Clone> RuntimeFixedList<T> {
277277

278278
pub fn take(&mut self) -> Self {
279279
let new = std::mem::take(&mut self.vec);
280+
*self = Self::new(vec![T::default(); self.len]);
280281
Self {
281282
vec: new,
282283
len: self.len,

0 commit comments

Comments
 (0)