Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoyla committed Nov 28, 2024
1 parent f67bcf0 commit e22d84d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions crates/daphne/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,12 @@ impl std::fmt::Display for DapBatchBucket {
}
}

type TimestampedReportList = Vec<(ReportId, Time)>;

/// A set of values related to reports in the same bucket.
#[derive(Debug)]
pub struct DapAggregateSpan<T> {
span: HashMap<DapBatchBucket, (T, Vec<(ReportId, Time)>)>,
span: HashMap<DapBatchBucket, (T, TimestampedReportList)>,
}

// We can't derive default because it will require T to be Default, which we don't need.
Expand All @@ -338,7 +340,7 @@ impl<T> Default for DapAggregateSpan<T> {
}

impl<T> IntoIterator for DapAggregateSpan<T> {
type IntoIter = <HashMap<DapBatchBucket, (T, Vec<(ReportId, Time)>)> as IntoIterator>::IntoIter;
type IntoIter = <HashMap<DapBatchBucket, (T, TimestampedReportList)> as IntoIterator>::IntoIter;

type Item = <Self::IntoIter as Iterator>::Item;

Expand Down Expand Up @@ -440,26 +442,26 @@ impl<T> DapAggregateSpan<T> {
}

/// Return an iterator over the aggregate span.
pub fn iter(&self) -> impl Iterator<Item = (&DapBatchBucket, &(T, Vec<(ReportId, Time)>))> {
pub fn iter(&self) -> impl Iterator<Item = (&DapBatchBucket, &(T, TimestampedReportList))> {
self.span.iter()
}
}

impl<T> FromIterator<(DapBatchBucket, (T, Vec<(ReportId, Time)>))> for DapAggregateSpan<T> {
impl<T> FromIterator<(DapBatchBucket, (T, TimestampedReportList))> for DapAggregateSpan<T> {
fn from_iter<I>(iter: I) -> Self
where
I: IntoIterator<Item = (DapBatchBucket, (T, Vec<(ReportId, Time)>))>,
I: IntoIterator<Item = (DapBatchBucket, (T, TimestampedReportList))>,
{
Self {
span: iter.into_iter().collect(),
}
}
}

impl<T> Extend<(DapBatchBucket, (T, Vec<(ReportId, Time)>))> for DapAggregateSpan<T> {
impl<T> Extend<(DapBatchBucket, (T, TimestampedReportList))> for DapAggregateSpan<T> {
fn extend<I>(&mut self, iter: I)
where
I: IntoIterator<Item = (DapBatchBucket, (T, Vec<(ReportId, Time)>))>,
I: IntoIterator<Item = (DapBatchBucket, (T, TimestampedReportList))>,
{
self.span.extend(iter);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/daphne/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mod base64url_bytes {
O: From<[u8; N]>,
{
struct Visitor<const N: usize, O>(std::marker::PhantomData<[O; N]>);
impl<'de, const N: usize, O> de::Visitor<'de> for Visitor<N, O>
impl<const N: usize, O> de::Visitor<'_> for Visitor<N, O>
where
O: From<[u8; N]>,
{
Expand Down
2 changes: 1 addition & 1 deletion crates/daphne/src/pine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ fn bits(x: u64) -> usize {
}

fn chunk_count(chunk_length: usize, length: usize) -> usize {
(length + chunk_length - 1) / chunk_length
length.div_ceil(chunk_length)
}

fn dst(algorithm_id: u32, usage: u16) -> [u8; DST_SIZE] {
Expand Down

0 comments on commit e22d84d

Please sign in to comment.