From 17e5a65864acb92a515c36cbdc142e1ffbea0140 Mon Sep 17 00:00:00 2001 From: Tommy Volk Date: Sun, 4 Aug 2024 13:03:28 -0500 Subject: [PATCH] chore: remove IntoDynNever --- fedimint-core/src/core.rs | 60 --------------------------------------- 1 file changed, 60 deletions(-) diff --git a/fedimint-core/src/core.rs b/fedimint-core/src/core.rs index 9c141e9fde0..3bae28a3e4f 100644 --- a/fedimint-core/src/core.rs +++ b/fedimint-core/src/core.rs @@ -12,7 +12,6 @@ use std::fmt::{Debug, Display, Formatter}; use std::io::Read; use std::str::FromStr; use std::sync::Arc; -use std::{cmp, marker}; use anyhow::anyhow; use bitcoin_hashes::{sha256, Hash}; @@ -228,10 +227,6 @@ impl Encodable for DynUnknown { } /// A type that has a `Dyn*`, type erased version of itself -/// -/// Use [`IntoDynNever`] in places where a given type will never -/// actually be created, but something is needed to appease the -/// type system. pub trait IntoDynInstance { /// The type erased version of the type implementing this trait type DynType: 'static; @@ -240,61 +235,6 @@ pub trait IntoDynInstance { fn into_dyn(self, instance_id: ModuleInstanceId) -> Self::DynType; } -enum Never {} - -/// Type that can be used as type-system placeholder for [`IntoDynInstance`] -pub struct IntoDynNever { - _phantom: marker::PhantomData, - // you can't make that - _never: Never, -} - -impl cmp::PartialEq for IntoDynNever { - fn eq(&self, _: &Self) -> bool { - unreachable!() - } -} - -impl cmp::Eq for IntoDynNever {} - -impl fmt::Debug for IntoDynNever { - fn fmt(&self, _: &mut Formatter<'_>) -> fmt::Result { - unreachable!() - } -} - -impl Clone for IntoDynNever { - fn clone(&self) -> Self { - unreachable!() - } -} - -impl Encodable for IntoDynNever { - fn consensus_encode(&self, _: &mut W) -> Result { - unreachable!() - } -} - -impl Decodable for IntoDynNever { - fn consensus_decode( - _: &mut R, - _: &ModuleDecoderRegistry, - ) -> Result { - unreachable!() - } -} - -impl IntoDynInstance for IntoDynNever -where - T: 'static, -{ - type DynType = T; - - fn into_dyn(self, _instance_id: ModuleInstanceId) -> Self::DynType { - unreachable!() - } -} - type DecodeFn = Box< dyn for<'a> Fn( Box,