From 3995e40e806d51090ea2a1662e3a770c7a97efa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabrielle=20Guimar=C3=A3es=20de=20Oliveira?= Date: Tue, 28 May 2024 22:53:25 -0300 Subject: [PATCH] feat(sol-diagnostic): fix implementation by using box --- sol-diagnostic/src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sol-diagnostic/src/lib.rs b/sol-diagnostic/src/lib.rs index 12907c4..49e2f86 100644 --- a/sol-diagnostic/src/lib.rs +++ b/sol-diagnostic/src/lib.rs @@ -45,20 +45,23 @@ impl IntoSolDiagnostic for Result { } } -#[derive(Clone, Debug)] -pub struct Diagnostic(pub Arc); +#[derive(Debug)] +pub struct Diagnostic(Box); impl Eq for Diagnostic {} impl From for Diagnostic { fn from(report: sol_eyre::Report) -> Self { - Self(Arc::new(report)) + Self(Box::new(report)) } } impl PartialEq for Diagnostic { fn eq(&self, other: &Diagnostic) -> bool { - Arc::ptr_eq(&self.0, &other.0) + let lhs: *const sol_eyre::Report = self.0.as_ref(); + let rhs: *const sol_eyre::Report = other.0.as_ref(); + + lhs == rhs && !lhs.is_null() } }