@@ -100,14 +100,14 @@ fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext<'_>
100
100
let target_module = parent. module ( ctx. db ( ) ) ;
101
101
102
102
let in_file_source = record_field_def. source ( ctx. db ( ) ) ?;
103
- let ( vis_owner, target) : ( ast :: AnyHasVisibility , TextRange ) = match in_file_source. value {
103
+ let ( vis_owner, target) = match in_file_source. value {
104
104
hir:: FieldSource :: Named ( it) => {
105
- let s = it. syntax ( ) ;
106
- ( ast:: AnyHasVisibility :: cast ( s . clone ( ) ) . unwrap ( ) , s . text_range ( ) )
105
+ let range = it. syntax ( ) . text_range ( ) ;
106
+ ( ast:: AnyHasVisibility :: new ( it ) , range )
107
107
}
108
108
hir:: FieldSource :: Pos ( it) => {
109
- let s = it. syntax ( ) ;
110
- ( ast:: AnyHasVisibility :: cast ( s . clone ( ) ) . unwrap ( ) , s . text_range ( ) )
109
+ let range = it. syntax ( ) . text_range ( ) ;
110
+ ( ast:: AnyHasVisibility :: new ( it ) , range )
111
111
}
112
112
} ;
113
113
@@ -152,12 +152,8 @@ fn target_data_for_def(
152
152
let source = x. source ( db) ?;
153
153
let in_file_syntax = source. syntax ( ) ;
154
154
let file_id = in_file_syntax. file_id ;
155
- let syntax = in_file_syntax. value ;
156
- Some ( (
157
- ast:: AnyHasVisibility :: cast ( syntax. clone ( ) ) . unwrap ( ) ,
158
- syntax. text_range ( ) ,
159
- file_id. original_file ( db. upcast ( ) ) ,
160
- ) )
155
+ let range = in_file_syntax. value . text_range ( ) ;
156
+ Some ( ( ast:: AnyHasVisibility :: new ( source. value ) , range, file_id. original_file ( db. upcast ( ) ) ) )
161
157
}
162
158
163
159
let target_name;
@@ -198,8 +194,8 @@ fn target_data_for_def(
198
194
target_name = m. name ( db) ;
199
195
let in_file_source = m. declaration_source ( db) ?;
200
196
let file_id = in_file_source. file_id . original_file ( db. upcast ( ) ) ;
201
- let syntax = in_file_source. value . syntax ( ) ;
202
- ( ast:: AnyHasVisibility :: cast ( syntax . clone ( ) ) . unwrap ( ) , syntax . text_range ( ) , file_id)
197
+ let range = in_file_source. value . syntax ( ) . text_range ( ) ;
198
+ ( ast:: AnyHasVisibility :: new ( in_file_source . value ) , range , file_id)
203
199
}
204
200
// FIXME
205
201
hir:: ModuleDef :: Macro ( _) => return None ,
0 commit comments