@@ -6,14 +6,15 @@ use ide_db::{
66 search:: { FileReference , ReferenceAccess , SearchScope } ,
77 RootDatabase ,
88} ;
9- use itertools :: Itertools ;
9+ use rustc_hash :: FxHashSet ;
1010use syntax:: {
1111 ast:: { self , LoopBodyOwner } ,
1212 match_ast, AstNode , SyntaxNode , SyntaxToken , TextRange , TextSize , T ,
1313} ;
1414
1515use crate :: { display:: TryToNav , references, NavigationTarget } ;
1616
17+ #[ derive( PartialEq , Eq , Hash ) ]
1718pub struct HighlightedRange {
1819 pub range : TextRange ,
1920 pub access : Option < ReferenceAccess > ,
@@ -100,11 +101,11 @@ fn highlight_references(
100101 } )
101102 } ) ;
102103
103- let res: Vec < _ > = declarations. chain ( usages) . collect ( ) ;
104+ let res: FxHashSet < _ > = declarations. chain ( usages) . collect ( ) ;
104105 if res. is_empty ( ) {
105106 None
106107 } else {
107- Some ( res)
108+ Some ( res. into_iter ( ) . collect ( ) )
108109 }
109110}
110111
@@ -276,7 +277,7 @@ fn find_defs(
276277 sema : & Semantics < RootDatabase > ,
277278 syntax : & SyntaxNode ,
278279 offset : TextSize ,
279- ) -> Vec < Definition > {
280+ ) -> FxHashSet < Definition > {
280281 sema. find_nodes_at_offset_with_descend ( syntax, offset)
281282 . flat_map ( |name_like| {
282283 Some ( match name_like {
@@ -309,7 +310,6 @@ fn find_defs(
309310 } )
310311 } )
311312 . flatten ( )
312- . unique ( )
313313 . collect ( )
314314}
315315
@@ -423,8 +423,6 @@ macro_rules! foo {
423423
424424foo!(bar$0);
425425 // ^^^
426- // ^^^
427- // ^^^
428426fn foo() {
429427 let bar: bar = bar();
430428 // ^^^
@@ -443,7 +441,6 @@ macro_rules! foo {
443441
444442foo!(bar);
445443 // ^^^
446- // ^^^
447444fn foo() {
448445 let bar: bar$0 = bar();
449446 // ^^^
@@ -873,7 +870,6 @@ fn function(field: u32) {
873870 //^^^^^
874871 Struct { field$0 }
875872 //^^^^^ read
876- //^^^^^ read
877873}
878874"# ,
879875 ) ;
0 commit comments