diff options
Diffstat (limited to 'crates/ra_assists/src/assist_ctx.rs')
-rw-r--r-- | crates/ra_assists/src/assist_ctx.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index b6cac96fa..f32072dbd 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! This module defines `AssistCtx` -- the API surface that is exposed to assists. | 1 | //! This module defines `AssistCtx` -- the API surface that is exposed to assists. |
2 | use either::Either; | 2 | use either::Either; |
3 | use hir::{db::HirDatabase, InFile, SourceAnalyzer, SourceBinder}; | 3 | use hir::{InFile, SourceAnalyzer, SourceBinder}; |
4 | use ra_db::{FileRange, SourceDatabase}; | 4 | use ra_db::{FileRange, SourceDatabase}; |
5 | use ra_fmt::{leading_indent, reindent}; | 5 | use ra_fmt::{leading_indent, reindent}; |
6 | use ra_ide_db::RootDatabase; | 6 | use ra_ide_db::RootDatabase; |
@@ -50,14 +50,14 @@ pub(crate) enum Assist { | |||
50 | /// moment, because the LSP API is pretty awkward in this place, and it's much | 50 | /// moment, because the LSP API is pretty awkward in this place, and it's much |
51 | /// easier to just compute the edit eagerly :-) | 51 | /// easier to just compute the edit eagerly :-) |
52 | #[derive(Debug)] | 52 | #[derive(Debug)] |
53 | pub(crate) struct AssistCtx<'a, DB> { | 53 | pub(crate) struct AssistCtx<'a> { |
54 | pub(crate) db: &'a DB, | 54 | pub(crate) db: &'a RootDatabase, |
55 | pub(crate) frange: FileRange, | 55 | pub(crate) frange: FileRange, |
56 | source_file: SourceFile, | 56 | source_file: SourceFile, |
57 | should_compute_edit: bool, | 57 | should_compute_edit: bool, |
58 | } | 58 | } |
59 | 59 | ||
60 | impl<'a, DB> Clone for AssistCtx<'a, DB> { | 60 | impl<'a> Clone for AssistCtx<'a> { |
61 | fn clone(&self) -> Self { | 61 | fn clone(&self) -> Self { |
62 | AssistCtx { | 62 | AssistCtx { |
63 | db: self.db, | 63 | db: self.db, |
@@ -68,7 +68,7 @@ impl<'a, DB> Clone for AssistCtx<'a, DB> { | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | impl<'a> AssistCtx<'a, RootDatabase> { | 71 | impl<'a> AssistCtx<'a> { |
72 | pub(crate) fn with_ctx<F, T>( | 72 | pub(crate) fn with_ctx<F, T>( |
73 | db: &RootDatabase, | 73 | db: &RootDatabase, |
74 | frange: FileRange, | 74 | frange: FileRange, |
@@ -76,7 +76,7 @@ impl<'a> AssistCtx<'a, RootDatabase> { | |||
76 | f: F, | 76 | f: F, |
77 | ) -> T | 77 | ) -> T |
78 | where | 78 | where |
79 | F: FnOnce(AssistCtx<RootDatabase>) -> T, | 79 | F: FnOnce(AssistCtx) -> T, |
80 | { | 80 | { |
81 | let parse = db.parse(frange.file_id); | 81 | let parse = db.parse(frange.file_id); |
82 | 82 | ||
@@ -85,7 +85,7 @@ impl<'a> AssistCtx<'a, RootDatabase> { | |||
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | impl<'a, DB: HirDatabase> AssistCtx<'a, DB> { | 88 | impl<'a> AssistCtx<'a> { |
89 | pub(crate) fn add_assist( | 89 | pub(crate) fn add_assist( |
90 | self, | 90 | self, |
91 | id: AssistId, | 91 | id: AssistId, |
@@ -149,7 +149,7 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> { | |||
149 | pub(crate) fn covering_element(&self) -> SyntaxElement { | 149 | pub(crate) fn covering_element(&self) -> SyntaxElement { |
150 | find_covering_element(self.source_file.syntax(), self.frange.range) | 150 | find_covering_element(self.source_file.syntax(), self.frange.range) |
151 | } | 151 | } |
152 | pub(crate) fn source_binder(&self) -> SourceBinder<'a, DB> { | 152 | pub(crate) fn source_binder(&self) -> SourceBinder<'a, RootDatabase> { |
153 | SourceBinder::new(self.db) | 153 | SourceBinder::new(self.db) |
154 | } | 154 | } |
155 | pub(crate) fn source_analyzer( | 155 | pub(crate) fn source_analyzer( |