Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions consensus/src/simplex/mocks/outdated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use commonware_cryptography::{certificate::Scheme, Hasher};
use commonware_p2p::{Receiver, Recipients, Sender};
use commonware_runtime::{spawn_cell, Clock, ContextCell, Handle, Spawner};
use rand_core::CryptoRngCore;
use std::{collections::HashMap, marker::PhantomData};
use std::collections::HashMap;
use tracing::debug;

pub struct Config<S: Scheme> {
Expand All @@ -27,8 +27,6 @@ pub struct Outdated<E: Clock + CryptoRngCore + Spawner, S: Scheme, H: Hasher> {

history: HashMap<View, Proposal<H::Digest>>,
view_delta: ViewDelta,

_hasher: PhantomData<H>,
}

impl<E, S, H> Outdated<E, S, H>
Expand All @@ -44,8 +42,6 @@ where

history: HashMap::new(),
view_delta: cfg.view_delta,

_hasher: PhantomData,
}
}

Expand Down
7 changes: 1 addition & 6 deletions p2p/src/utils/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,12 @@ impl<'a, S: Sender, V: Codec> CheckedWrappedSender<'a, S, V> {
pub struct WrappedReceiver<R: Receiver, V: Codec> {
config: V::Cfg,
receiver: R,
_phantom_v: std::marker::PhantomData<V>,
}

impl<R: Receiver, V: Codec> WrappedReceiver<R, V> {
/// Create a new [WrappedReceiver] with the given [Receiver].
pub const fn new(config: V::Cfg, receiver: R) -> Self {
Self {
config,
receiver,
_phantom_v: std::marker::PhantomData,
}
Self { config, receiver }
}

/// Receive a message from an arbitrary recipient.
Expand Down
2 changes: 0 additions & 2 deletions resolver/src/p2p/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ pub struct Engine<
metrics: metrics::Metrics<E>,

/// Phantom data for networking types
_s: PhantomData<NetS>,
_r: PhantomData<NetR>,
}

Expand Down Expand Up @@ -138,7 +137,6 @@ impl<
priority_responses: cfg.priority_responses,
metrics,
fetch_timers: HashMap::new(),
_s: PhantomData,
_r: PhantomData,
},
Mailbox::new(sender),
Expand Down
8 changes: 1 addition & 7 deletions storage/src/freezer/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ use commonware_runtime::{buffer, Blob, Clock, Metrics, Storage};
use commonware_utils::{Array, Span};
use futures::future::{try_join, try_join_all};
use prometheus_client::metrics::counter::Counter;
use std::{
cmp::Ordering, collections::BTreeSet, marker::PhantomData, num::NonZeroUsize, ops::Deref,
};
use std::{cmp::Ordering, collections::BTreeSet, num::NonZeroUsize, ops::Deref};
use tracing::debug;

/// The percentage of table entries that must reach `table_resize_frequency`
Expand Down Expand Up @@ -407,9 +405,6 @@ pub struct Freezer<E: Storage + Metrics + Clock, K: Array, V: Codec> {
unnecessary_reads: Counter,
unnecessary_writes: Counter,
resizes: Counter,

// Phantom data to satisfy the compiler about generic types
_phantom: PhantomData<(K, V)>,
}

impl<E: Storage + Metrics + Clock, K: Array, V: Codec> Freezer<E, K, V> {
Expand Down Expand Up @@ -784,7 +779,6 @@ impl<E: Storage + Metrics + Clock, K: Array, V: Codec> Freezer<E, K, V> {
unnecessary_reads,
unnecessary_writes,
resizes,
_phantom: PhantomData,
})
}

Expand Down
14 changes: 4 additions & 10 deletions storage/src/translator.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//! Primitive implementations of [Translator].

use std::{
hash::{BuildHasher, Hash, Hasher},
marker::PhantomData,
};
use std::hash::{BuildHasher, Hash, Hasher};

/// Translate keys into a new representation (often a smaller one).
///
Expand Down Expand Up @@ -149,21 +146,18 @@ impl<const N: usize> PartialEq<[u8; N]> for UnhashedArray<N> {

/// Translators for keys that are not the length of a standard integer.
#[derive(Clone, Copy)]
pub struct Cap<const N: usize> {
_phantom: PhantomData<[u8; N]>,
}
pub struct Cap<const N: usize>;

impl<const N: usize> Cap<N> {
pub const fn new() -> Self {
const {
assert!(N <= 8 && N > 0, "Cap must be between 1 and 8");
};
Self {
_phantom: PhantomData,
}
Self
}
}

// Manually implement Default for Cap<N> so it calls new() which validates N.
impl<const N: usize> Default for Cap<N> {
fn default() -> Self {
Self::new()
Expand Down
Loading