From 13dec8a67471852b12bd9f3d4903ab1c06255c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Fri, 8 Dec 2023 13:54:52 +0100 Subject: [PATCH] Remove usage of phantomdata --- src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fc71934..93d055a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,7 +9,6 @@ use core::{ cmp::Ordering, fmt::{self, Debug}, hash::{Hash, Hasher}, - marker::PhantomData, ops::{Deref, DerefMut}, ptr, }; @@ -354,10 +353,9 @@ impl<'de, const N: usize> Deserialize<'de> for Bytes { where D: Deserializer<'de>, { - struct ValueVisitor<'de, const N: usize>(PhantomData<&'de ()>); + struct ValueVisitor; - impl<'de, const N: usize> Visitor<'de> for ValueVisitor<'de, N> { - // type Value = Vec; + impl<'de, const N: usize> Visitor<'de> for ValueVisitor { type Value = Bytes; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -387,7 +385,7 @@ impl<'de, const N: usize> Deserialize<'de> for Bytes { } } - deserializer.deserialize_bytes(ValueVisitor(PhantomData)) + deserializer.deserialize_bytes(ValueVisitor) } }