File tree Expand file tree Collapse file tree 2 files changed +4
-18
lines changed
ide-diagnostics/src/handlers Expand file tree Collapse file tree 2 files changed +4
-18
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,7 @@ pub fn use_trivial_constructor(
2929 ) ) ,
3030 ) ;
3131
32- use hir:: StructKind :: * ;
33- let is_record = match variant. kind ( db) {
34- Record => true ,
35- Tuple => false ,
36- Unit => false ,
37- } ;
32+ let is_record = variant. kind ( db) == hir:: StructKind :: Record ;
3833
3934 return Some ( if is_record {
4035 ast:: Expr :: RecordExpr ( syntax:: ast:: make:: record_expr (
@@ -48,9 +43,7 @@ pub fn use_trivial_constructor(
4843 }
4944 }
5045 Some ( hir:: Adt :: Struct ( x) ) => {
51- let fields = x. fields ( db) ;
52-
53- if fields. is_empty ( ) {
46+ if x. fields ( db) . is_empty ( ) {
5447 return Some ( syntax:: ast:: make:: expr_path ( path) ) ;
5548 }
5649 }
Original file line number Diff line number Diff line change @@ -38,12 +38,7 @@ pub fn use_trivial_constructor(
3838 ) ) ,
3939 ) ;
4040
41- use hir:: StructKind :: * ;
42- let is_record = match variant. kind ( db) {
43- Record => true ,
44- Tuple => false ,
45- Unit => false ,
46- } ;
41+ let is_record = variant. kind ( db) == hir:: StructKind :: Record ;
4742
4843 return Some ( if is_record {
4944 ast:: Expr :: RecordExpr ( syntax:: ast:: make:: record_expr (
@@ -57,9 +52,7 @@ pub fn use_trivial_constructor(
5752 }
5853 }
5954 Some ( hir:: Adt :: Struct ( x) ) => {
60- let fields = x. fields ( db) ;
61-
62- if fields. is_empty ( ) {
55+ if x. fields ( db) . is_empty ( ) {
6356 return Some ( syntax:: ast:: make:: expr_path ( path) ) ;
6457 }
6558 }
You can’t perform that action at this time.
0 commit comments