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(
29
29
) ) ,
30
30
) ;
31
31
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 ;
38
33
39
34
return Some ( if is_record {
40
35
ast:: Expr :: RecordExpr ( syntax:: ast:: make:: record_expr (
@@ -48,9 +43,7 @@ pub fn use_trivial_constructor(
48
43
}
49
44
}
50
45
Some ( hir:: Adt :: Struct ( x) ) => {
51
- let fields = x. fields ( db) ;
52
-
53
- if fields. is_empty ( ) {
46
+ if x. fields ( db) . is_empty ( ) {
54
47
return Some ( syntax:: ast:: make:: expr_path ( path) ) ;
55
48
}
56
49
}
Original file line number Diff line number Diff line change @@ -38,12 +38,7 @@ pub fn use_trivial_constructor(
38
38
) ) ,
39
39
) ;
40
40
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 ;
47
42
48
43
return Some ( if is_record {
49
44
ast:: Expr :: RecordExpr ( syntax:: ast:: make:: record_expr (
@@ -57,9 +52,7 @@ pub fn use_trivial_constructor(
57
52
}
58
53
}
59
54
Some ( hir:: Adt :: Struct ( x) ) => {
60
- let fields = x. fields ( db) ;
61
-
62
- if fields. is_empty ( ) {
55
+ if x. fields ( db) . is_empty ( ) {
63
56
return Some ( syntax:: ast:: make:: expr_path ( path) ) ;
64
57
}
65
58
}
You can’t perform that action at this time.
0 commit comments