From f57239729cb9d6f60eb09d8cfd8244066b5e182c Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 23 Jan 2020 21:15:16 +0200 Subject: Remove unnecessary lifetime parameter --- crates/ra_assists/src/assists/auto_import.rs | 4 ++-- crates/ra_assists/src/lib.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'crates/ra_assists') 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::{ // let map = HashMap<|>::new(); // } // ``` -pub(crate) fn auto_import<'a, F: ImportsLocator<'a>>( +pub(crate) fn auto_import( ctx: AssistCtx, imports_locator: &mut F, ) -> Option { @@ -108,7 +108,7 @@ mod tests { } } - impl<'a> ImportsLocator<'_> for TestImportsLocator<'_> { + impl<'a> ImportsLocator for TestImportsLocator<'a> { fn find_imports( &mut self, _: 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 /// due to the search functionality located there. /// Later, this trait should be removed completely and the search functionality moved to a separate crate, /// accessible from the ra_assists crate. -pub trait ImportsLocator<'a> { +pub trait ImportsLocator { /// Finds all imports for the given name and the module that contains this name. fn find_imports( &mut self, @@ -97,14 +97,14 @@ pub trait ImportsLocator<'a> { /// /// Assists are returned in the "resolved" state, that is with edit fully /// computed. -pub fn assists_with_imports_locator<'a, H, F: 'a>( +pub fn assists_with_imports_locator( db: &H, range: FileRange, mut imports_locator: F, ) -> Vec where H: HirDatabase + 'static, - F: ImportsLocator<'a>, + F: ImportsLocator, { AssistCtx::with_ctx(db, range, true, |ctx| { let mut assists = assists::all() @@ -222,7 +222,7 @@ mod assists { ] } - pub(crate) fn all_with_imports_locator<'a, DB: HirDatabase, F: ImportsLocator<'a>>( + pub(crate) fn all_with_imports_locator<'a, DB: HirDatabase, F: ImportsLocator>( ) -> &'a [fn(AssistCtx, &mut F) -> Option] { &[auto_import::auto_import] } @@ -264,7 +264,7 @@ mod helpers { assert_eq_text!(after, &actual); } - pub(crate) fn check_assist_with_imports_locator<'a, F: ImportsLocator<'a>>( + pub(crate) fn check_assist_with_imports_locator( assist: fn(AssistCtx, &mut F) -> Option, imports_locator: &mut F, before: &str, @@ -366,7 +366,7 @@ mod helpers { assert!(assist.is_none()); } - pub(crate) fn check_assist_with_imports_locator_not_applicable<'a, F: ImportsLocator<'a>>( + pub(crate) fn check_assist_with_imports_locator_not_applicable( assist: fn(AssistCtx, &mut F) -> Option, imports_locator: &mut F, before: &str, -- cgit v1.2.3