@@ -100,14 +100,14 @@ fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext<'_>
100100 let target_module = parent. module ( ctx. db ( ) ) ;
101101
102102 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 {
104104 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 )
107107 }
108108 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 )
111111 }
112112 } ;
113113
@@ -152,12 +152,8 @@ fn target_data_for_def(
152152 let source = x. source ( db) ?;
153153 let in_file_syntax = source. syntax ( ) ;
154154 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 ( ) ) ) )
161157 }
162158
163159 let target_name;
@@ -198,8 +194,8 @@ fn target_data_for_def(
198194 target_name = m. name ( db) ;
199195 let in_file_source = m. declaration_source ( db) ?;
200196 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)
203199 }
204200 // FIXME
205201 hir:: ModuleDef :: Macro ( _) => return None ,
0 commit comments