Remove unnecessary lifetime parameter

This commit is contained in:
Kirill Bulatov 2020-01-23 21:15:16 +02:00
parent 316795e074
commit f57239729c
3 changed files with 9 additions and 9 deletions

View File

@ -28,7 +28,7 @@ use crate::{
// let map = HashMap<|>::new(); // let map = HashMap<|>::new();
// } // }
// ``` // ```
pub(crate) fn auto_import<'a, F: ImportsLocator<'a>>( pub(crate) fn auto_import<F: ImportsLocator>(
ctx: AssistCtx<impl HirDatabase>, ctx: AssistCtx<impl HirDatabase>,
imports_locator: &mut F, imports_locator: &mut F,
) -> Option<Assist> { ) -> Option<Assist> {
@ -108,7 +108,7 @@ mod tests {
} }
} }
impl<'a> ImportsLocator<'_> for TestImportsLocator<'_> { impl<'a> ImportsLocator for TestImportsLocator<'a> {
fn find_imports( fn find_imports(
&mut self, &mut self,
_: hir::InFile<&ast::NameRef>, _: hir::InFile<&ast::NameRef>,

View File

@ -83,7 +83,7 @@ where
/// due to the search functionality located there. /// due to the search functionality located there.
/// Later, this trait should be removed completely and the search functionality moved to a separate crate, /// Later, this trait should be removed completely and the search functionality moved to a separate crate,
/// accessible from the ra_assists 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. /// Finds all imports for the given name and the module that contains this name.
fn find_imports( fn find_imports(
&mut self, &mut self,
@ -97,14 +97,14 @@ pub trait ImportsLocator<'a> {
/// ///
/// Assists are returned in the "resolved" state, that is with edit fully /// Assists are returned in the "resolved" state, that is with edit fully
/// computed. /// computed.
pub fn assists_with_imports_locator<'a, H, F: 'a>( pub fn assists_with_imports_locator<H, F>(
db: &H, db: &H,
range: FileRange, range: FileRange,
mut imports_locator: F, mut imports_locator: F,
) -> Vec<ResolvedAssist> ) -> Vec<ResolvedAssist>
where where
H: HirDatabase + 'static, H: HirDatabase + 'static,
F: ImportsLocator<'a>, F: ImportsLocator,
{ {
AssistCtx::with_ctx(db, range, true, |ctx| { AssistCtx::with_ctx(db, range, true, |ctx| {
let mut assists = assists::all() 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<DB>, &mut F) -> Option<Assist>] { ) -> &'a [fn(AssistCtx<DB>, &mut F) -> Option<Assist>] {
&[auto_import::auto_import] &[auto_import::auto_import]
} }
@ -264,7 +264,7 @@ mod helpers {
assert_eq_text!(after, &actual); 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<F: ImportsLocator>(
assist: fn(AssistCtx<TestDB>, &mut F) -> Option<Assist>, assist: fn(AssistCtx<TestDB>, &mut F) -> Option<Assist>,
imports_locator: &mut F, imports_locator: &mut F,
before: &str, before: &str,
@ -366,7 +366,7 @@ mod helpers {
assert!(assist.is_none()); 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<F: ImportsLocator>(
assist: fn(AssistCtx<TestDB>, &mut F) -> Option<Assist>, assist: fn(AssistCtx<TestDB>, &mut F) -> Option<Assist>,
imports_locator: &mut F, imports_locator: &mut F,
before: &str, before: &str,

View File

@ -82,7 +82,7 @@ impl<'a> ImportsLocatorIde<'a> {
} }
} }
impl<'a> ImportsLocator<'a> for ImportsLocatorIde<'a> { impl<'a> ImportsLocator for ImportsLocatorIde<'a> {
fn find_imports( fn find_imports(
&mut self, &mut self,
name_to_import: InFile<&NameRef>, name_to_import: InFile<&NameRef>,