@@ -127,7 +127,7 @@ impl SearchScope {
127
127
}
128
128
129
129
/// Build a search scope spanning the given module and all its submodules.
130
- fn module_and_children ( db : & RootDatabase , module : hir:: Module ) -> SearchScope {
130
+ pub fn module_and_children ( db : & RootDatabase , module : hir:: Module ) -> SearchScope {
131
131
let mut entries = IntMap :: default ( ) ;
132
132
133
133
let ( file_id, range) = {
@@ -329,7 +329,7 @@ impl Definition {
329
329
pub struct FindUsages < ' a > {
330
330
def : Definition ,
331
331
sema : & ' a Semantics < ' a , RootDatabase > ,
332
- scope : Option < SearchScope > ,
332
+ scope : Option < & ' a SearchScope > ,
333
333
/// The container of our definition should it be an assoc item
334
334
assoc_item_container : Option < hir:: AssocItemContainer > ,
335
335
/// whether to search for the `Self` type of the definition
@@ -338,7 +338,7 @@ pub struct FindUsages<'a> {
338
338
search_self_mod : bool ,
339
339
}
340
340
341
- impl FindUsages < ' _ > {
341
+ impl < ' a > FindUsages < ' a > {
342
342
/// Enable searching for `Self` when the definition is a type or `self` for modules.
343
343
pub fn include_self_refs ( mut self ) -> Self {
344
344
self . include_self_kw_refs = def_to_ty ( self . sema , & self . def ) ;
@@ -347,12 +347,12 @@ impl FindUsages<'_> {
347
347
}
348
348
349
349
/// Limit the search to a given [`SearchScope`].
350
- pub fn in_scope ( self , scope : SearchScope ) -> Self {
350
+ pub fn in_scope ( self , scope : & ' a SearchScope ) -> Self {
351
351
self . set_scope ( Some ( scope) )
352
352
}
353
353
354
354
/// Limit the search to a given [`SearchScope`].
355
- pub fn set_scope ( mut self , scope : Option < SearchScope > ) -> Self {
355
+ pub fn set_scope ( mut self , scope : Option < & ' a SearchScope > ) -> Self {
356
356
assert ! ( self . scope. is_none( ) ) ;
357
357
self . scope = scope;
358
358
self
@@ -376,7 +376,7 @@ impl FindUsages<'_> {
376
376
res
377
377
}
378
378
379
- fn search ( & self , sink : & mut dyn FnMut ( FileId , FileReference ) -> bool ) {
379
+ pub fn search ( & self , sink : & mut dyn FnMut ( FileId , FileReference ) -> bool ) {
380
380
let _p = profile:: span ( "FindUsages:search" ) ;
381
381
let sema = self . sema ;
382
382
0 commit comments