From cf812c12d1ac7944d1c18877ee93bea02d91e99f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 6 Feb 2020 16:58:57 +0100 Subject: Assists are not generic --- crates/ra_assists/src/lib.rs | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'crates/ra_assists/src/lib.rs') diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index be6e06842..ad8438b6c 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs @@ -148,7 +148,6 @@ fn sort_assists(assists: &mut Vec) { mod assists { use crate::{Assist, AssistCtx, ImportsLocator}; - use hir::db::HirDatabase; mod add_derive; mod add_explicit_type; @@ -176,7 +175,7 @@ mod assists { mod move_bounds; mod early_return; - pub(crate) fn all() -> &'static [fn(AssistCtx) -> Option] { + pub(crate) fn all() -> &'static [fn(AssistCtx) -> Option] { &[ add_derive::add_derive, add_explicit_type::add_explicit_type, @@ -210,8 +209,8 @@ mod assists { ] } - pub(crate) fn all_with_imports_locator<'a, DB: HirDatabase, F: ImportsLocator>( - ) -> &'a [fn(AssistCtx, &mut F) -> Option] { + pub(crate) fn all_with_imports_locator<'a, F: ImportsLocator>( + ) -> &'a [fn(AssistCtx, &mut F) -> Option] { &[auto_import::auto_import] } } @@ -274,11 +273,7 @@ mod helpers { } } - pub(crate) fn check_assist( - assist: fn(AssistCtx) -> Option, - before: &str, - after: &str, - ) { + pub(crate) fn check_assist(assist: fn(AssistCtx) -> Option, before: &str, after: &str) { let (before_cursor_pos, before) = extract_offset(before); let (db, file_id) = RootDatabase::with_single_file(&before); let frange = @@ -303,7 +298,7 @@ mod helpers { } pub(crate) fn check_assist_with_imports_locator( - assist: fn(AssistCtx, &mut F) -> Option, + assist: fn(AssistCtx, &mut F) -> Option, imports_locator_provider: fn(db: Arc, file_id: FileId) -> F, before: &str, after: &str, @@ -335,7 +330,7 @@ mod helpers { } pub(crate) fn check_assist_range( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, after: &str, ) { @@ -357,7 +352,7 @@ mod helpers { } pub(crate) fn check_assist_target( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, target: &str, ) { @@ -377,7 +372,7 @@ mod helpers { } pub(crate) fn check_assist_range_target( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, target: &str, ) { @@ -396,7 +391,7 @@ mod helpers { } pub(crate) fn check_assist_not_applicable( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, ) { let (before_cursor_pos, before) = extract_offset(before); @@ -408,7 +403,7 @@ mod helpers { } pub(crate) fn check_assist_with_imports_locator_not_applicable( - assist: fn(AssistCtx, &mut F) -> Option, + assist: fn(AssistCtx, &mut F) -> Option, imports_locator_provider: fn(db: Arc, file_id: FileId) -> F, before: &str, ) { @@ -424,7 +419,7 @@ mod helpers { } pub(crate) fn check_assist_range_not_applicable( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, ) { let (range, before) = extract_range(before); -- cgit v1.2.3