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 04ff73e commit fd359ba
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/daphne-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ mod signing_key_serializer {
D::Error: serde::de::Error,
{
struct Visitor;
impl<'de> de::Visitor<'de> for Visitor {
impl de::Visitor<'_> for Visitor {
type Value = SigningKey;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
formatter.write_str("a sec1 pem key")
Expand Down
2 changes: 1 addition & 1 deletion crates/daphne-server/src/storage_proxy_connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl<'d, B: DurableMethod> RequestBuilder<'d, B, [u8; 0]> {
}
}

impl<'w> Do<'w> {
impl Do<'_> {
pub fn request<B: DurableMethod + Copy>(
&self,
path: B,
Expand Down
1 change: 1 addition & 0 deletions crates/daphne-service-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub mod test_route_types;
mod durable_request_capnp {
#![allow(dead_code)]
#![allow(clippy::pedantic)]
#![allow(clippy::needless_lifetimes)]
include!(concat!(
env!("OUT_DIR"),
"/src/durable_requests/durable_request_capnp.rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/daphne-worker/src/tracing_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub type JsonFields = HashMap<String, serde_json::Value>;

pub struct JsonVisitor<'a>(&'a mut JsonFields);

impl<'a> Visit for JsonVisitor<'a> {
impl Visit for JsonVisitor<'_> {
fn record_f64(&mut self, field: &Field, value: f64) {
if let Ok(value) = serde_json::to_value(value) {
self.0.insert(field.name().to_string(), value);
Expand Down
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 fd359ba

Please sign in to comment.