Repository: SeaQL/sea-orm (rust)

Issue:
scripts generated by `sea-orm-cli` cannot pass clippy 
This is typical script generated by `sea-orm-cli` without existing relation:
```rust
//! SeaORM Entity. Generated by sea-orm-codegen 0.3.2

use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "posts")]
pub struct Model {
    #[sea_orm(primary_key)]
    #[serde(skip_deserializing)]
    pub id: i32,
    pub title: String,
    #[sea_orm(column_type = "Text")]
    pub text: String,
}

#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}

impl RelationTrait for Relation {
    fn def(&self) -> RelationDef {
        match self {
            _ => panic!("No RelationDef"),
        }
    }
}

impl ActiveModelBehavior for ActiveModel {}
```

When I run `cargo cilppy`, there is a warning:
```
warning: this match could be replaced by its body itself
  --> src/post.rs:22:9
   |
22 | /         match self {
23 | |             _ => panic!("No RelationDef"),
24 | |         }
   | |_________^ help: consider using the match body instead: `panic!("No RelationDef")`
   |
   = note: `#[warn(clippy::match_single_binding)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_single_binding
``` 
Could someone fix it?

Pull request description:
Codegen fix clippy warnings
## Info
- Resolve #296

Patch:
diff --git a/sea-orm-codegen/src/entity/writer.rs b/sea-orm-codegen/src/entity/writer.rs
index be3c47bb..0efba306 100644
--- a/sea-orm-codegen/src/entity/writer.rs
+++ b/sea-orm-codegen/src/entity/writer.rs
@@ -328,19 +328,19 @@ impl EntityWriter {
         let relation_defs = entity.get_relation_defs();
         let quoted = if relation_ref_tables_camel_case.is_empty() {
             quote! {
-                _ => panic!("No RelationDef"),
+                panic!("No RelationDef")
             }
         } else {
             quote! {
-                #(Self::#relation_ref_tables_camel_case => #relation_defs,)*
+                match self {
+                    #(Self::#relation_ref_tables_camel_case => #relation_defs,)*
+                }
             }
         };
         quote! {
             impl RelationTrait for Relation {
                 fn def(&self) -> RelationDef {
-                    match self {
-                        #quoted
-                    }
+                    #quoted
                 }
             }
         }


Test patch:
diff --git a/sea-orm-codegen/tests/compact/filling.rs b/sea-orm-codegen/tests/compact/filling.rs
index 820f65c8..dfedb1a7 100644
--- a/sea-orm-codegen/tests/compact/filling.rs
+++ b/sea-orm-codegen/tests/compact/filling.rs
@@ -15,9 +15,7 @@ pub enum Relation {}
 
 impl RelationTrait for Relation {
     fn def(&self) -> RelationDef {
-        match self {
-            _ => panic!("No RelationDef"),
-        }
+        panic!("No RelationDef")
     }
 }
 
diff --git a/sea-orm-codegen/tests/compact/rust_keyword.rs b/sea-orm-codegen/tests/compact/rust_keyword.rs
index 229eae22..9a7bd9eb 100644
--- a/sea-orm-codegen/tests/compact/rust_keyword.rs
+++ b/sea-orm-codegen/tests/compact/rust_keyword.rs
@@ -21,9 +21,7 @@ pub enum Relation {}
 
 impl RelationTrait for Relation {
     fn def(&self) -> RelationDef {
-        match self {
-            _ => panic!("No RelationDef"),
-        }
+        panic!("No RelationDef")
     }
 }
 
diff --git a/sea-orm-codegen/tests/expanded/filling.rs b/sea-orm-codegen/tests/expanded/filling.rs
index 73d58152..76764ecf 100644
--- a/sea-orm-codegen/tests/expanded/filling.rs
+++ b/sea-orm-codegen/tests/expanded/filling.rs
@@ -51,9 +51,7 @@ impl ColumnTrait for Column {
 
 impl RelationTrait for Relation {
     fn def(&self) -> RelationDef {
-        match self {
-            _ => panic!("No RelationDef"),
-        }
+        panic!("No RelationDef")
     }
 }
 
diff --git a/sea-orm-codegen/tests/expanded/rust_keyword.rs b/sea-orm-codegen/tests/expanded/rust_keyword.rs
index 1ab8a627..e83cc9ea 100644
--- a/sea-orm-codegen/tests/expanded/rust_keyword.rs
+++ b/sea-orm-codegen/tests/expanded/rust_keyword.rs
@@ -70,9 +70,7 @@ impl ColumnTrait for Column {
 
 impl RelationTrait for Relation {
     fn def(&self) -> RelationDef {
-        match self {
-            _ => panic!("No RelationDef"),
-        }
+        panic!("No RelationDef")
     }
 }