From 8b217239fdf36285f0730ad5096f527510413b91 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Mon, 8 Nov 2021 12:13:29 +0800 Subject: [PATCH] Fix clippy warnings --- sea-orm-codegen/src/entity/writer.rs | 10 +++++----- sea-orm-codegen/tests/compact/filling.rs | 4 +--- sea-orm-codegen/tests/compact/rust_keyword.rs | 4 +--- sea-orm-codegen/tests/expanded/filling.rs | 4 +--- sea-orm-codegen/tests/expanded/rust_keyword.rs | 4 +--- 5 files changed, 9 insertions(+), 17 deletions(-) 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 } } } 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") } }