Repository: Brendonovich/prisma-client-rust (language: rust)

Issue:
User Prisma enums don't derive PartialEq
Comparing enums generated from Prisma enums is currently a bit annoying since you can't compare them directly with `==`, and `match`ing them indents your code more.
I feel like they should derive `PartialEq` and `Eq`.
```prisma
enum Stuff {
  ONE
  TWO
  THREE
}
```
```rust
if thing == Stuff::One /* binary operation `==` cannot be applied to type `prisma::Thing`  */ {
    // ...
}
```
Without it, the workaround is to use `match` or convert the values to a string with `.to_string()` and compare that.


Discussion / hints:
That's a good point, in the meantime I'd suggest using `matches!`.

Fix patch:
diff --git a/cli/src/generator/enums.rs b/cli/src/generator/enums.rs
index 5eec2958..9e088bb5 100644
--- a/cli/src/generator/enums.rs
+++ b/cli/src/generator/enums.rs
@@ -42,7 +42,7 @@ pub fn generate(args: &GenerateArgs) -> TokenStream {
 
         quote! {
             #specta_derive
-            #[derive(Debug, Clone, Copy, ::serde::Serialize, ::serde::Deserialize)]
+            #[derive(Debug, Clone, Copy, ::serde::Serialize, ::serde::Deserialize, PartialEq, Eq)]
             pub enum #name {
                 #(#variants),*
             }
diff --git a/cli/src/generator/internal_enums.rs b/cli/src/generator/internal_enums.rs
index 3286cc0a..cddbe274 100644
--- a/cli/src/generator/internal_enums.rs
+++ b/cli/src/generator/internal_enums.rs
@@ -36,7 +36,7 @@ pub fn generate(args: &GenerateArgs) -> TokenStream {
                 .collect::<Vec<_>>();
 
             quote! {
-                #[derive(Debug, Clone, Copy, ::serde::Serialize, ::serde::Deserialize)]
+                #[derive(Debug, Clone, Copy, ::serde::Serialize, ::serde::Deserialize, PartialEq, Eq)]
                 pub enum #name {
                     #(#variants),*
                 }


Test patch: