diff options
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/assists/auto_import.rs | 4 | ||||
-rw-r--r-- | crates/ra_assists/src/lib.rs | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_assists/src/assists/auto_import.rs b/crates/ra_assists/src/assists/auto_import.rs index fe226521e..ae216944b 100644 --- a/crates/ra_assists/src/assists/auto_import.rs +++ b/crates/ra_assists/src/assists/auto_import.rs | |||
@@ -28,7 +28,7 @@ use crate::{ | |||
28 | // let map = HashMap<|>::new(); | 28 | // let map = HashMap<|>::new(); |
29 | // } | 29 | // } |
30 | // ``` | 30 | // ``` |
31 | pub(crate) fn auto_import<'a, F: ImportsLocator<'a>>( | 31 | pub(crate) fn auto_import<F: ImportsLocator>( |
32 | ctx: AssistCtx<impl HirDatabase>, | 32 | ctx: AssistCtx<impl HirDatabase>, |
33 | imports_locator: &mut F, | 33 | imports_locator: &mut F, |
34 | ) -> Option<Assist> { | 34 | ) -> Option<Assist> { |
@@ -108,7 +108,7 @@ mod tests { | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | impl<'a> ImportsLocator<'_> for TestImportsLocator<'_> { | 111 | impl<'a> ImportsLocator for TestImportsLocator<'a> { |
112 | fn find_imports( | 112 | fn find_imports( |
113 | &mut self, | 113 | &mut self, |
114 | _: hir::InFile<&ast::NameRef>, | 114 | _: hir::InFile<&ast::NameRef>, |
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 4029962f7..381a51df6 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -83,7 +83,7 @@ where | |||
83 | /// due to the search functionality located there. | 83 | /// due to the search functionality located there. |
84 | /// Later, this trait should be removed completely and the search functionality moved to a separate crate, | 84 | /// Later, this trait should be removed completely and the search functionality moved to a separate crate, |
85 | /// accessible from the ra_assists crate. | 85 | /// accessible from the ra_assists crate. |
86 | pub trait ImportsLocator<'a> { | 86 | pub trait ImportsLocator { |
87 | /// Finds all imports for the given name and the module that contains this name. | 87 | /// Finds all imports for the given name and the module that contains this name. |
88 | fn find_imports( | 88 | fn find_imports( |
89 | &mut self, | 89 | &mut self, |
@@ -97,14 +97,14 @@ pub trait ImportsLocator<'a> { | |||
97 | /// | 97 | /// |
98 | /// Assists are returned in the "resolved" state, that is with edit fully | 98 | /// Assists are returned in the "resolved" state, that is with edit fully |
99 | /// computed. | 99 | /// computed. |
100 | pub fn assists_with_imports_locator<'a, H, F: 'a>( | 100 | pub fn assists_with_imports_locator<H, F>( |
101 | db: &H, | 101 | db: &H, |
102 | range: FileRange, | 102 | range: FileRange, |
103 | mut imports_locator: F, | 103 | mut imports_locator: F, |
104 | ) -> Vec<ResolvedAssist> | 104 | ) -> Vec<ResolvedAssist> |
105 | where | 105 | where |
106 | H: HirDatabase + 'static, | 106 | H: HirDatabase + 'static, |
107 | F: ImportsLocator<'a>, | 107 | F: ImportsLocator, |
108 | { | 108 | { |
109 | AssistCtx::with_ctx(db, range, true, |ctx| { | 109 | AssistCtx::with_ctx(db, range, true, |ctx| { |
110 | let mut assists = assists::all() | 110 | let mut assists = assists::all() |
@@ -222,7 +222,7 @@ mod assists { | |||
222 | ] | 222 | ] |
223 | } | 223 | } |
224 | 224 | ||
225 | pub(crate) fn all_with_imports_locator<'a, DB: HirDatabase, F: ImportsLocator<'a>>( | 225 | pub(crate) fn all_with_imports_locator<'a, DB: HirDatabase, F: ImportsLocator>( |
226 | ) -> &'a [fn(AssistCtx<DB>, &mut F) -> Option<Assist>] { | 226 | ) -> &'a [fn(AssistCtx<DB>, &mut F) -> Option<Assist>] { |
227 | &[auto_import::auto_import] | 227 | &[auto_import::auto_import] |
228 | } | 228 | } |
@@ -264,7 +264,7 @@ mod helpers { | |||
264 | assert_eq_text!(after, &actual); | 264 | assert_eq_text!(after, &actual); |
265 | } | 265 | } |
266 | 266 | ||
267 | pub(crate) fn check_assist_with_imports_locator<'a, F: ImportsLocator<'a>>( | 267 | pub(crate) fn check_assist_with_imports_locator<F: ImportsLocator>( |
268 | assist: fn(AssistCtx<TestDB>, &mut F) -> Option<Assist>, | 268 | assist: fn(AssistCtx<TestDB>, &mut F) -> Option<Assist>, |
269 | imports_locator: &mut F, | 269 | imports_locator: &mut F, |
270 | before: &str, | 270 | before: &str, |
@@ -366,7 +366,7 @@ mod helpers { | |||
366 | assert!(assist.is_none()); | 366 | assert!(assist.is_none()); |
367 | } | 367 | } |
368 | 368 | ||
369 | pub(crate) fn check_assist_with_imports_locator_not_applicable<'a, F: ImportsLocator<'a>>( | 369 | pub(crate) fn check_assist_with_imports_locator_not_applicable<F: ImportsLocator>( |
370 | assist: fn(AssistCtx<TestDB>, &mut F) -> Option<Assist>, | 370 | assist: fn(AssistCtx<TestDB>, &mut F) -> Option<Assist>, |
371 | imports_locator: &mut F, | 371 | imports_locator: &mut F, |
372 | before: &str, | 372 | before: &str, |