2
2
3
3
use std:: sync:: Arc ;
4
4
5
- use hir_expand:: { name:: Name , AstId , ExpandResult , HirFileId , MacroCallId , MacroDefKind , InFile } ;
5
+ use hir_expand:: { name:: Name , AstId , ExpandResult , HirFileId , InFile , MacroCallId , MacroDefKind } ;
6
6
use smallvec:: SmallVec ;
7
7
use syntax:: ast;
8
8
@@ -12,7 +12,10 @@ use crate::{
12
12
db:: DefDatabase ,
13
13
intern:: Interned ,
14
14
item_tree:: { self , AssocItem , FnFlags , ItemTree , ItemTreeId , ModItem , Param , TreeId } ,
15
- nameres:: { attr_resolution:: ResolvedAttr , proc_macro:: ProcMacroKind , DefMap , diagnostics:: DefDiagnostic } ,
15
+ nameres:: {
16
+ attr_resolution:: ResolvedAttr , diagnostics:: DefDiagnostic , proc_macro:: ProcMacroKind ,
17
+ DefMap ,
18
+ } ,
16
19
type_ref:: { TraitRef , TypeBound , TypeRef } ,
17
20
visibility:: RawVisibility ,
18
21
AssocItemId , AstIdWithPath , ConstId , ConstLoc , FunctionId , FunctionLoc , HasModule , ImplId ,
@@ -213,7 +216,10 @@ impl TraitData {
213
216
db. trait_data_with_diagnostics ( tr) . 0
214
217
}
215
218
216
- pub ( crate ) fn trait_data_with_diagnostics_query ( db : & dyn DefDatabase , tr : TraitId ) -> ( Arc < TraitData > , Arc < Vec < DefDiagnostic > > ) {
219
+ pub ( crate ) fn trait_data_with_diagnostics_query (
220
+ db : & dyn DefDatabase ,
221
+ tr : TraitId ,
222
+ ) -> ( Arc < TraitData > , Arc < Vec < DefDiagnostic > > ) {
217
223
let tr_loc @ ItemLoc { container : module_id, id : tree_id } = tr. lookup ( db) ;
218
224
let item_tree = tree_id. item_tree ( db) ;
219
225
let tr_def = & item_tree[ tree_id. value ] ;
@@ -245,7 +251,7 @@ impl TraitData {
245
251
visibility,
246
252
skip_array_during_method_dispatch,
247
253
} ) ,
248
- Arc :: new ( diagnostics)
254
+ Arc :: new ( diagnostics) ,
249
255
)
250
256
}
251
257
@@ -290,7 +296,10 @@ impl ImplData {
290
296
db. impl_data_with_diagnostics ( id) . 0
291
297
}
292
298
293
- pub ( crate ) fn impl_data_with_diagnostics_query ( db : & dyn DefDatabase , id : ImplId ) -> ( Arc < ImplData > , Arc < Vec < DefDiagnostic > > ) {
299
+ pub ( crate ) fn impl_data_with_diagnostics_query (
300
+ db : & dyn DefDatabase ,
301
+ id : ImplId ,
302
+ ) -> ( Arc < ImplData > , Arc < Vec < DefDiagnostic > > ) {
294
303
let _p = profile:: span ( "impl_data_with_diagnostics_query" ) ;
295
304
let ItemLoc { container : module_id, id : tree_id } = id. lookup ( db) ;
296
305
@@ -307,7 +316,10 @@ impl ImplData {
307
316
let ( items, attribute_calls, diagnostics) = collector. finish ( ) ;
308
317
let items = items. into_iter ( ) . map ( |( _, item) | item) . collect ( ) ;
309
318
310
- ( Arc :: new ( ImplData { target_trait, self_ty, items, is_negative, attribute_calls } ) , Arc :: new ( diagnostics) )
319
+ (
320
+ Arc :: new ( ImplData { target_trait, self_ty, items, is_negative, attribute_calls } ) ,
321
+ Arc :: new ( diagnostics) ,
322
+ )
311
323
}
312
324
313
325
pub fn attribute_calls ( & self ) -> impl Iterator < Item = ( AstId < ast:: Item > , MacroCallId ) > + ' _ {
@@ -477,11 +489,15 @@ impl<'a> AssocItemCollector<'a> {
477
489
478
490
fn finish (
479
491
self ,
480
- ) -> ( Vec < ( Name , AssocItemId ) > , Option < Box < Vec < ( AstId < ast:: Item > , MacroCallId ) > > > , Vec < DefDiagnostic > ) {
492
+ ) -> (
493
+ Vec < ( Name , AssocItemId ) > ,
494
+ Option < Box < Vec < ( AstId < ast:: Item > , MacroCallId ) > > > ,
495
+ Vec < DefDiagnostic > ,
496
+ ) {
481
497
(
482
498
self . items ,
483
499
if self . attr_calls . is_empty ( ) { None } else { Some ( Box :: new ( self . attr_calls ) ) } ,
484
- self . inactive_diagnostics
500
+ self . inactive_diagnostics ,
485
501
)
486
502
}
487
503
@@ -497,7 +513,7 @@ impl<'a> AssocItemCollector<'a> {
497
513
self . module_id . local_id ,
498
514
InFile :: new ( self . expander . current_file_id ( ) , item. ast_id ( & item_tree) . upcast ( ) ) ,
499
515
attrs. cfg ( ) . unwrap ( ) ,
500
- self . expander . cfg_options ( ) . clone ( )
516
+ self . expander . cfg_options ( ) . clone ( ) ,
501
517
) ) ;
502
518
continue ;
503
519
}
0 commit comments