Skip to content

Commit b3be0f4

Browse files
committed
clean up lifetime constraints
1 parent 6eff0c1 commit b3be0f4

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

vote/src/vote_state_view/field_frames.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use {
55
std::io::BufRead,
66
};
77

8-
pub(super) trait ListFrame<'frame> {
9-
type Item: 'frame;
8+
pub(super) trait ListFrame {
9+
type Item;
1010

1111
fn len(&self) -> usize;
1212
fn item_size(&self) -> usize {
@@ -28,7 +28,7 @@ pub(super) enum VotesFrame {
2828
Landed(LandedVotesListFrame),
2929
}
3030

31-
impl ListFrame<'_> for VotesFrame {
31+
impl ListFrame for VotesFrame {
3232
type Item = LockoutItem;
3333

3434
fn len(&self) -> usize {
@@ -87,7 +87,7 @@ impl LockoutListFrame {
8787
}
8888
}
8989

90-
impl ListFrame<'_> for LockoutListFrame {
90+
impl ListFrame for LockoutListFrame {
9191
type Item = LockoutItem;
9292

9393
fn len(&self) -> usize {
@@ -119,7 +119,7 @@ pub(super) struct LandedVoteItem {
119119
confirmation_count: [u8; 4],
120120
}
121121

122-
impl ListFrame<'_> for LandedVotesListFrame {
122+
impl ListFrame for LandedVotesListFrame {
123123
type Item = LockoutItem;
124124

125125
fn len(&self) -> usize {
@@ -158,7 +158,7 @@ pub(super) struct AuthorizedVoterItem {
158158
voter: Pubkey,
159159
}
160160

161-
impl ListFrame<'_> for AuthorizedVotersListFrame {
161+
impl ListFrame for AuthorizedVotersListFrame {
162162
type Item = AuthorizedVoterItem;
163163

164164
fn len(&self) -> usize {
@@ -203,7 +203,7 @@ impl EpochCreditsListFrame {
203203
}
204204
}
205205

206-
impl ListFrame<'_> for EpochCreditsListFrame {
206+
impl ListFrame for EpochCreditsListFrame {
207207
type Item = EpochCreditsItem;
208208

209209
fn len(&self) -> usize {
@@ -288,7 +288,7 @@ impl RootSlotFrame {
288288

289289
pub(super) struct PriorVotersFrame;
290290

291-
impl ListFrame<'_> for PriorVotersFrame {
291+
impl ListFrame for PriorVotersFrame {
292292
type Item = PriorVotersItem;
293293

294294
fn len(&self) -> usize {

vote/src/vote_state_view/list_view.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub(super) struct ListView<'a, F> {
55
item_buffer: &'a [u8],
66
}
77

8-
impl<'a, F: ListFrame<'a>> ListView<'a, F> {
8+
impl<'a, F: ListFrame> ListView<'a, F> {
99
pub(super) fn new(frame: F, buffer: &'a [u8]) -> Self {
1010
let len_offset = core::mem::size_of::<u64>();
1111
let item_buffer = &buffer[len_offset..];
@@ -53,7 +53,10 @@ pub(super) struct ListViewIter<'a, F> {
5353
view: ListView<'a, F>,
5454
}
5555

56-
impl<'a, F: ListFrame<'a>> Iterator for ListViewIter<'a, F> {
56+
impl<'a, F: ListFrame> Iterator for ListViewIter<'a, F>
57+
where
58+
F::Item: 'a,
59+
{
5760
type Item = &'a F::Item;
5861
fn next(&mut self) -> Option<Self::Item> {
5962
if self.index < self.view.len() {
@@ -66,7 +69,10 @@ impl<'a, F: ListFrame<'a>> Iterator for ListViewIter<'a, F> {
6669
}
6770
}
6871

69-
impl<'a, F: ListFrame<'a>> DoubleEndedIterator for ListViewIter<'a, F> {
72+
impl<'a, F: ListFrame> DoubleEndedIterator for ListViewIter<'a, F>
73+
where
74+
F::Item: 'a,
75+
{
7076
fn next_back(&mut self) -> Option<Self::Item> {
7177
if self.rev_index < self.view.len() {
7278
let item = self.view.item(self.view.len() - self.rev_index - 1);

0 commit comments

Comments
 (0)