File tree 1 file changed +1
-10
lines changed
crates/ide-assists/src/handlers
1 file changed +1
-10
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ fn add_variant_to_accumulator(
59
59
adt : hir:: Enum ,
60
60
name_ref : & ast:: NameRef ,
61
61
) -> Option < ( ) > {
62
- let adt_ast = get_enum_ast ( ctx, adt ) ? ;
62
+ let adt_ast = adt . source ( ctx. db ( ) ) ? . original_ast_node ( ctx . db ( ) ) ? . value ;
63
63
64
64
let enum_indent_level = IndentLevel :: from_node ( & adt_ast. syntax ( ) ) ;
65
65
@@ -80,15 +80,6 @@ fn add_variant_to_accumulator(
80
80
)
81
81
}
82
82
83
- fn get_enum_ast ( ctx : & AssistContext , adt : hir:: Enum ) -> Option < ast:: Enum > {
84
- let range = adt. source ( ctx. db ( ) ) ?. syntax ( ) . original_file_range ( ctx. db ( ) ) ;
85
- let file = ctx. sema . parse ( range. file_id ) ;
86
- let adt_ast: ast:: Enum =
87
- ctx. sema . find_node_at_offset_with_macros ( file. syntax ( ) , range. range . start ( ) ) ?;
88
-
89
- Some ( adt_ast)
90
- }
91
-
92
83
#[ cfg( test) ]
93
84
mod tests {
94
85
use crate :: tests:: { check_assist, check_assist_not_applicable} ;
You can’t perform that action at this time.
0 commit comments