svlog: Add custom Clone/Copy for Ref
@@ -165,9 +165,16 @@ mod crate_prelude {
/// This reference is useful when querying the compiler database for information
/// about a node. It compares the reference *by pointer address*, thus allowing
/// for pessimistic compiler queries.
-#[derive(Copy, Clone)]
pub struct Ref<'a, T: 'a + ?Sized>(&'a T);
+impl<'a, T: ?Sized> Copy for Ref<'a, T> {}
+
+impl<'a, T: ?Sized> Clone for Ref<'a, T> {
+ fn clone(&self) -> Self {
+ Ref(self.0)
+ }
+}
+
impl<'a, T: ?Sized> From<&'a T> for Ref<'a, T> {
fn from(r: &'a T) -> Ref<'a, T> {
Ref(r)
@@ -214,15 +221,6 @@ where
}
}
-impl<T: ?Sized> std::fmt::Binary for Ref<'_, T>
-where
- T: std::fmt::Binary,
-{
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- std::fmt::Binary::fmt(self.0, f)
- }
-}
-
/// A few checks to ensure that `Ref` can be passed around properly.
#[allow(dead_code, unused_variables)]
mod checks {
