@@ -131,13 +131,8 @@ impl SourceToDefCtx<'_, '_> {
131
131
132
132
pub ( super ) fn module_to_def ( & mut self , src : InFile < ast:: Module > ) -> Option < ModuleId > {
133
133
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| {
141
136
let m = ast:: Module :: cast ( it. value . clone ( ) ) ?;
142
137
Some ( it. with_value ( m) )
143
138
} ) ;
@@ -217,7 +212,7 @@ impl SourceToDefCtx<'_, '_> {
217
212
& mut self ,
218
213
src : InFile < ast:: IdentPat > ,
219
214
) -> 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 ( ) ) ?;
221
216
let ( _body, source_map) = self . db . body_with_source_map ( container) ;
222
217
let src = src. map ( ast:: Pat :: from) ;
223
218
let pat_id = source_map. node_pat ( src. as_ref ( ) ) ?;
@@ -227,7 +222,7 @@ impl SourceToDefCtx<'_, '_> {
227
222
& mut self ,
228
223
src : InFile < ast:: SelfParam > ,
229
224
) -> 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 ( ) ) ?;
231
226
let ( _body, source_map) = self . db . body_with_source_map ( container) ;
232
227
let pat_id = source_map. node_self_param ( src. as_ref ( ) ) ?;
233
228
Some ( ( container, pat_id) )
@@ -236,7 +231,7 @@ impl SourceToDefCtx<'_, '_> {
236
231
& mut self ,
237
232
src : InFile < ast:: Label > ,
238
233
) -> 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 ( ) ) ?;
240
235
let ( _body, source_map) = self . db . body_with_source_map ( container) ;
241
236
let label_id = source_map. node_label ( src. as_ref ( ) ) ?;
242
237
Some ( ( container, label_id) )
@@ -264,8 +259,7 @@ impl SourceToDefCtx<'_, '_> {
264
259
}
265
260
266
261
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 ( ) ;
269
263
let db = self . db ;
270
264
let dyn_map =
271
265
& * self . cache . entry ( container) . or_insert_with ( || container. child_by_source ( db) ) ;
@@ -276,8 +270,7 @@ impl SourceToDefCtx<'_, '_> {
276
270
& mut self ,
277
271
src : InFile < ast:: LifetimeParam > ,
278
272
) -> 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 ( ) ;
281
274
let db = self . db ;
282
275
let dyn_map =
283
276
& * self . cache . entry ( container) . or_insert_with ( || container. child_by_source ( db) ) ;
@@ -288,8 +281,7 @@ impl SourceToDefCtx<'_, '_> {
288
281
& mut self ,
289
282
src : InFile < ast:: ConstParam > ,
290
283
) -> 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 ( ) ;
293
285
let db = self . db ;
294
286
let dyn_map =
295
287
& * self . cache . entry ( container) . or_insert_with ( || container. child_by_source ( db) ) ;
0 commit comments