@@ -131,13 +131,8 @@ impl SourceToDefCtx<'_, '_> {
131131
132132 pub ( super ) fn module_to_def ( & mut self , src : InFile < ast:: Module > ) -> Option < ModuleId > {
133133 let _p = profile:: span ( "module_to_def" ) ;
134- let parent_declaration = src
135- . as_ref ( )
136- . map ( |it| it. syntax ( ) )
137- . cloned ( )
138- . ancestors_with_macros ( self . db . upcast ( ) )
139- . skip ( 1 )
140- . find_map ( |it| {
134+ let parent_declaration =
135+ src. syntax ( ) . cloned ( ) . ancestors_with_macros ( self . db . upcast ( ) ) . skip ( 1 ) . find_map ( |it| {
141136 let m = ast:: Module :: cast ( it. value . clone ( ) ) ?;
142137 Some ( it. with_value ( m) )
143138 } ) ;
@@ -217,7 +212,7 @@ impl SourceToDefCtx<'_, '_> {
217212 & mut self ,
218213 src : InFile < ast:: IdentPat > ,
219214 ) -> Option < ( DefWithBodyId , PatId ) > {
220- let container = self . find_pat_or_label_container ( src. as_ref ( ) . map ( |it| it . syntax ( ) ) ) ?;
215+ let container = self . find_pat_or_label_container ( src. syntax ( ) ) ?;
221216 let ( _body, source_map) = self . db . body_with_source_map ( container) ;
222217 let src = src. map ( ast:: Pat :: from) ;
223218 let pat_id = source_map. node_pat ( src. as_ref ( ) ) ?;
@@ -227,7 +222,7 @@ impl SourceToDefCtx<'_, '_> {
227222 & mut self ,
228223 src : InFile < ast:: SelfParam > ,
229224 ) -> Option < ( DefWithBodyId , PatId ) > {
230- let container = self . find_pat_or_label_container ( src. as_ref ( ) . map ( |it| it . syntax ( ) ) ) ?;
225+ let container = self . find_pat_or_label_container ( src. syntax ( ) ) ?;
231226 let ( _body, source_map) = self . db . body_with_source_map ( container) ;
232227 let pat_id = source_map. node_self_param ( src. as_ref ( ) ) ?;
233228 Some ( ( container, pat_id) )
@@ -236,7 +231,7 @@ impl SourceToDefCtx<'_, '_> {
236231 & mut self ,
237232 src : InFile < ast:: Label > ,
238233 ) -> Option < ( DefWithBodyId , LabelId ) > {
239- let container = self . find_pat_or_label_container ( src. as_ref ( ) . map ( |it| it . syntax ( ) ) ) ?;
234+ let container = self . find_pat_or_label_container ( src. syntax ( ) ) ?;
240235 let ( _body, source_map) = self . db . body_with_source_map ( container) ;
241236 let label_id = source_map. node_label ( src. as_ref ( ) ) ?;
242237 Some ( ( container, label_id) )
@@ -264,8 +259,7 @@ impl SourceToDefCtx<'_, '_> {
264259 }
265260
266261 pub ( super ) fn type_param_to_def ( & mut self , src : InFile < ast:: TypeParam > ) -> Option < TypeParamId > {
267- let container: ChildContainer =
268- self . find_generic_param_container ( src. as_ref ( ) . map ( |it| it. syntax ( ) ) ) ?. into ( ) ;
262+ let container: ChildContainer = self . find_generic_param_container ( src. syntax ( ) ) ?. into ( ) ;
269263 let db = self . db ;
270264 let dyn_map =
271265 & * self . cache . entry ( container) . or_insert_with ( || container. child_by_source ( db) ) ;
@@ -276,8 +270,7 @@ impl SourceToDefCtx<'_, '_> {
276270 & mut self ,
277271 src : InFile < ast:: LifetimeParam > ,
278272 ) -> Option < LifetimeParamId > {
279- let container: ChildContainer =
280- self . find_generic_param_container ( src. as_ref ( ) . map ( |it| it. syntax ( ) ) ) ?. into ( ) ;
273+ let container: ChildContainer = self . find_generic_param_container ( src. syntax ( ) ) ?. into ( ) ;
281274 let db = self . db ;
282275 let dyn_map =
283276 & * self . cache . entry ( container) . or_insert_with ( || container. child_by_source ( db) ) ;
@@ -288,8 +281,7 @@ impl SourceToDefCtx<'_, '_> {
288281 & mut self ,
289282 src : InFile < ast:: ConstParam > ,
290283 ) -> Option < ConstParamId > {
291- let container: ChildContainer =
292- self . find_generic_param_container ( src. as_ref ( ) . map ( |it| it. syntax ( ) ) ) ?. into ( ) ;
284+ let container: ChildContainer = self . find_generic_param_container ( src. syntax ( ) ) ?. into ( ) ;
293285 let db = self . db ;
294286 let dyn_map =
295287 & * self . cache . entry ( container) . or_insert_with ( || container. child_by_source ( db) ) ;
0 commit comments