From e6c702463087f701952ed02500e4a73635576ca7 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Tue, 15 Aug 2023 00:07:24 +0200 Subject: [PATCH] Implement common traits for `TranspiledSource` I've recently run into the issue that `TranspiledSource` is not `Clone`, requiring me to manually clone each field. Considering that a derive is trivial here, it should hopefully save some headaches in the future. I've also implemented all other relevant traits from STD, based on https://rust-lang.github.io/api-guidelines/interoperability.html#types-eagerly-implement-common-traits-c-common-traits. --- src/transpiling/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/transpiling/mod.rs b/src/transpiling/mod.rs index 1150cf1..8263030 100644 --- a/src/transpiling/mod.rs +++ b/src/transpiling/mod.rs @@ -162,6 +162,7 @@ impl crate::swc::common::source_map::SourceMapGenConfig for SourceMapConfig { } /// Source transpiled based on the emit options. +#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Debug)] pub struct TranspiledSource { /// Transpiled text. pub text: String,