aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/lib.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-06 15:58:57 +0000
committerAleksey Kladov <[email protected]>2020-02-06 16:12:02 +0000
commitcf812c12d1ac7944d1c18877ee93bea02d91e99f (patch)
tree71e13733941e2c0520cfe5d16fb00f428f3233da /crates/ra_assists/src/lib.rs
parentf8965ffafd5cf467b3f0482ca962ba2bfd090161 (diff)
Assists are not generic
Diffstat (limited to 'crates/ra_assists/src/lib.rs')
-rw-r--r--crates/ra_assists/src/lib.rs27
1 files changed, 11 insertions, 16 deletions
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<ResolvedAssist>) {
148 148
149mod assists { 149mod assists {
150 use crate::{Assist, AssistCtx, ImportsLocator}; 150 use crate::{Assist, AssistCtx, ImportsLocator};
151 use hir::db::HirDatabase;
152 151
153 mod add_derive; 152 mod add_derive;
154 mod add_explicit_type; 153 mod add_explicit_type;
@@ -176,7 +175,7 @@ mod assists {
176 mod move_bounds; 175 mod move_bounds;
177 mod early_return; 176 mod early_return;
178 177
179 pub(crate) fn all<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assist>] { 178 pub(crate) fn all() -> &'static [fn(AssistCtx) -> Option<Assist>] {
180 &[ 179 &[
181 add_derive::add_derive, 180 add_derive::add_derive,
182 add_explicit_type::add_explicit_type, 181 add_explicit_type::add_explicit_type,
@@ -210,8 +209,8 @@ mod assists {
210 ] 209 ]
211 } 210 }
212 211
213 pub(crate) fn all_with_imports_locator<'a, DB: HirDatabase, F: ImportsLocator>( 212 pub(crate) fn all_with_imports_locator<'a, F: ImportsLocator>(
214 ) -> &'a [fn(AssistCtx<DB>, &mut F) -> Option<Assist>] { 213 ) -> &'a [fn(AssistCtx, &mut F) -> Option<Assist>] {
215 &[auto_import::auto_import] 214 &[auto_import::auto_import]
216 } 215 }
217} 216}
@@ -274,11 +273,7 @@ mod helpers {
274 } 273 }
275 } 274 }
276 275
277 pub(crate) fn check_assist( 276 pub(crate) fn check_assist(assist: fn(AssistCtx) -> Option<Assist>, before: &str, after: &str) {
278 assist: fn(AssistCtx<RootDatabase>) -> Option<Assist>,
279 before: &str,
280 after: &str,
281 ) {
282 let (before_cursor_pos, before) = extract_offset(before); 277 let (before_cursor_pos, before) = extract_offset(before);
283 let (db, file_id) = RootDatabase::with_single_file(&before); 278 let (db, file_id) = RootDatabase::with_single_file(&before);
284 let frange = 279 let frange =
@@ -303,7 +298,7 @@ mod helpers {
303 } 298 }
304 299
305 pub(crate) fn check_assist_with_imports_locator<F: ImportsLocator>( 300 pub(crate) fn check_assist_with_imports_locator<F: ImportsLocator>(
306 assist: fn(AssistCtx<RootDatabase>, &mut F) -> Option<Assist>, 301 assist: fn(AssistCtx, &mut F) -> Option<Assist>,
307 imports_locator_provider: fn(db: Arc<RootDatabase>, file_id: FileId) -> F, 302 imports_locator_provider: fn(db: Arc<RootDatabase>, file_id: FileId) -> F,
308 before: &str, 303 before: &str,
309 after: &str, 304 after: &str,
@@ -335,7 +330,7 @@ mod helpers {
335 } 330 }
336 331
337 pub(crate) fn check_assist_range( 332 pub(crate) fn check_assist_range(
338 assist: fn(AssistCtx<RootDatabase>) -> Option<Assist>, 333 assist: fn(AssistCtx) -> Option<Assist>,
339 before: &str, 334 before: &str,
340 after: &str, 335 after: &str,
341 ) { 336 ) {
@@ -357,7 +352,7 @@ mod helpers {
357 } 352 }
358 353
359 pub(crate) fn check_assist_target( 354 pub(crate) fn check_assist_target(
360 assist: fn(AssistCtx<RootDatabase>) -> Option<Assist>, 355 assist: fn(AssistCtx) -> Option<Assist>,
361 before: &str, 356 before: &str,
362 target: &str, 357 target: &str,
363 ) { 358 ) {
@@ -377,7 +372,7 @@ mod helpers {
377 } 372 }
378 373
379 pub(crate) fn check_assist_range_target( 374 pub(crate) fn check_assist_range_target(
380 assist: fn(AssistCtx<RootDatabase>) -> Option<Assist>, 375 assist: fn(AssistCtx) -> Option<Assist>,
381 before: &str, 376 before: &str,
382 target: &str, 377 target: &str,
383 ) { 378 ) {
@@ -396,7 +391,7 @@ mod helpers {
396 } 391 }
397 392
398 pub(crate) fn check_assist_not_applicable( 393 pub(crate) fn check_assist_not_applicable(
399 assist: fn(AssistCtx<RootDatabase>) -> Option<Assist>, 394 assist: fn(AssistCtx) -> Option<Assist>,
400 before: &str, 395 before: &str,
401 ) { 396 ) {
402 let (before_cursor_pos, before) = extract_offset(before); 397 let (before_cursor_pos, before) = extract_offset(before);
@@ -408,7 +403,7 @@ mod helpers {
408 } 403 }
409 404
410 pub(crate) fn check_assist_with_imports_locator_not_applicable<F: ImportsLocator>( 405 pub(crate) fn check_assist_with_imports_locator_not_applicable<F: ImportsLocator>(
411 assist: fn(AssistCtx<RootDatabase>, &mut F) -> Option<Assist>, 406 assist: fn(AssistCtx, &mut F) -> Option<Assist>,
412 imports_locator_provider: fn(db: Arc<RootDatabase>, file_id: FileId) -> F, 407 imports_locator_provider: fn(db: Arc<RootDatabase>, file_id: FileId) -> F,
413 before: &str, 408 before: &str,
414 ) { 409 ) {
@@ -424,7 +419,7 @@ mod helpers {
424 } 419 }
425 420
426 pub(crate) fn check_assist_range_not_applicable( 421 pub(crate) fn check_assist_range_not_applicable(
427 assist: fn(AssistCtx<RootDatabase>) -> Option<Assist>, 422 assist: fn(AssistCtx) -> Option<Assist>,
428 before: &str, 423 before: &str,
429 ) { 424 ) {
430 let (range, before) = extract_range(before); 425 let (range, before) = extract_range(before);