diff --git a/hugr-core/src/types/signature.rs b/hugr-core/src/types/signature.rs index c5d3459e1..7578554ce 100644 --- a/hugr-core/src/types/signature.rs +++ b/hugr-core/src/types/signature.rs @@ -2,6 +2,7 @@ use itertools::Either; +use std::borrow::Cow; use std::fmt::{self, Display, Write}; use super::type_param::TypeParam; @@ -14,7 +15,7 @@ use crate::extension::{ExtensionRegistry, ExtensionSet, SignatureError}; use crate::{Direction, IncomingPort, OutgoingPort, Port}; #[cfg(test)] -use {crate::proptest::RecursionDepth, ::proptest::prelude::*, proptest_derive::Arbitrary}; +use {crate::proptest::RecursionDepth, proptest::prelude::*, proptest_derive::Arbitrary}; #[derive(Clone, Debug, Eq, Hash, serde::Serialize, serde::Deserialize)] #[cfg_attr(test, derive(Arbitrary), proptest(params = "RecursionDepth"))] @@ -319,6 +320,18 @@ impl PartialEq> for FuncTypeBase PartialEq>> for FuncTypeBase { + fn eq(&self, other: &Cow<'_, FuncTypeBase>) -> bool { + self.eq(other.as_ref()) + } +} + +impl PartialEq> for Cow<'_, FuncTypeBase> { + fn eq(&self, other: &FuncTypeBase) -> bool { + self.as_ref().eq(other) + } +} + #[cfg(test)] mod test { use crate::{extension::prelude::usize_t, type_row};