diff --git a/consensus/src/simplex/mocks/outdated.rs b/consensus/src/simplex/mocks/outdated.rs index 5c6deef270..f5ee1ee521 100644 --- a/consensus/src/simplex/mocks/outdated.rs +++ b/consensus/src/simplex/mocks/outdated.rs @@ -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 { @@ -27,8 +27,6 @@ pub struct Outdated { history: HashMap>, view_delta: ViewDelta, - - _hasher: PhantomData, } impl Outdated @@ -44,8 +42,6 @@ where history: HashMap::new(), view_delta: cfg.view_delta, - - _hasher: PhantomData, } } diff --git a/p2p/src/utils/codec.rs b/p2p/src/utils/codec.rs index 38b5661385..f1ccee79d1 100644 --- a/p2p/src/utils/codec.rs +++ b/p2p/src/utils/codec.rs @@ -83,17 +83,12 @@ impl<'a, S: Sender, V: Codec> CheckedWrappedSender<'a, S, V> { pub struct WrappedReceiver { config: V::Cfg, receiver: R, - _phantom_v: std::marker::PhantomData, } impl WrappedReceiver { /// 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. diff --git a/resolver/src/p2p/engine.rs b/resolver/src/p2p/engine.rs index d7e37978f3..6a26e5cfda 100644 --- a/resolver/src/p2p/engine.rs +++ b/resolver/src/p2p/engine.rs @@ -90,7 +90,6 @@ pub struct Engine< metrics: metrics::Metrics, /// Phantom data for networking types - _s: PhantomData, _r: PhantomData, } @@ -138,7 +137,6 @@ impl< priority_responses: cfg.priority_responses, metrics, fetch_timers: HashMap::new(), - _s: PhantomData, _r: PhantomData, }, Mailbox::new(sender), diff --git a/storage/src/freezer/storage.rs b/storage/src/freezer/storage.rs index b434200965..f4ae56933a 100644 --- a/storage/src/freezer/storage.rs +++ b/storage/src/freezer/storage.rs @@ -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` @@ -407,9 +405,6 @@ pub struct Freezer { unnecessary_reads: Counter, unnecessary_writes: Counter, resizes: Counter, - - // Phantom data to satisfy the compiler about generic types - _phantom: PhantomData<(K, V)>, } impl Freezer { @@ -784,7 +779,6 @@ impl Freezer { unnecessary_reads, unnecessary_writes, resizes, - _phantom: PhantomData, }) } diff --git a/storage/src/translator.rs b/storage/src/translator.rs index 3c424926de..ee04f79ed8 100644 --- a/storage/src/translator.rs +++ b/storage/src/translator.rs @@ -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). /// @@ -149,21 +146,18 @@ impl PartialEq<[u8; N]> for UnhashedArray { /// Translators for keys that are not the length of a standard integer. #[derive(Clone, Copy)] -pub struct Cap { - _phantom: PhantomData<[u8; N]>, -} +pub struct Cap; impl Cap { 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 so it calls new() which validates N. impl Default for Cap { fn default() -> Self { Self::new()