diff options
author | Nick Spain <[email protected]> | 2021-01-01 02:05:28 +0000 |
---|---|---|
committer | Nick Spain <[email protected]> | 2021-01-02 10:53:51 +0000 |
commit | 27cadcd531c017aa7c78c6f7a36f2b7f2ce8a196 (patch) | |
tree | 24f43261eeafffc8b98be361c9c2841c2e4861f0 /crates/completion | |
parent | aa3ce16f2641b7eb562a8eae67738b0ff0c0b7b0 (diff) |
HasSource::source -> HasSource::source_old
To start migrating HasSource::source to return an Option.
Diffstat (limited to 'crates/completion')
-rw-r--r-- | crates/completion/src/completions/trait_impl.rs | 4 | ||||
-rw-r--r-- | crates/completion/src/render/const_.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/function.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/macro_.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/type_alias.rs | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/crates/completion/src/completions/trait_impl.rs b/crates/completion/src/completions/trait_impl.rs index c4e0d0669..759253c53 100644 --- a/crates/completion/src/completions/trait_impl.rs +++ b/crates/completion/src/completions/trait_impl.rs | |||
@@ -156,7 +156,7 @@ fn add_function_impl( | |||
156 | }; | 156 | }; |
157 | let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end()); | 157 | let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end()); |
158 | 158 | ||
159 | let function_decl = function_declaration(&func.source(ctx.db).value); | 159 | let function_decl = function_declaration(&func.source_old(ctx.db).value); |
160 | match ctx.config.snippet_cap { | 160 | match ctx.config.snippet_cap { |
161 | Some(cap) => { | 161 | Some(cap) => { |
162 | let snippet = format!("{} {{\n $0\n}}", function_decl); | 162 | let snippet = format!("{} {{\n $0\n}}", function_decl); |
@@ -200,7 +200,7 @@ fn add_const_impl( | |||
200 | let const_name = const_.name(ctx.db).map(|n| n.to_string()); | 200 | let const_name = const_.name(ctx.db).map(|n| n.to_string()); |
201 | 201 | ||
202 | if let Some(const_name) = const_name { | 202 | if let Some(const_name) = const_name { |
203 | let snippet = make_const_compl_syntax(&const_.source(ctx.db).value); | 203 | let snippet = make_const_compl_syntax(&const_.source_old(ctx.db).value); |
204 | 204 | ||
205 | let range = TextRange::new(const_def_node.text_range().start(), ctx.source_range().end()); | 205 | let range = TextRange::new(const_def_node.text_range().start(), ctx.source_range().end()); |
206 | 206 | ||
diff --git a/crates/completion/src/render/const_.rs b/crates/completion/src/render/const_.rs index 039bdabc0..a8820a4fe 100644 --- a/crates/completion/src/render/const_.rs +++ b/crates/completion/src/render/const_.rs | |||
@@ -27,7 +27,7 @@ struct ConstRender<'a> { | |||
27 | 27 | ||
28 | impl<'a> ConstRender<'a> { | 28 | impl<'a> ConstRender<'a> { |
29 | fn new(ctx: RenderContext<'a>, const_: hir::Const) -> ConstRender<'a> { | 29 | fn new(ctx: RenderContext<'a>, const_: hir::Const) -> ConstRender<'a> { |
30 | let ast_node = const_.source(ctx.db()).value; | 30 | let ast_node = const_.source_old(ctx.db()).value; |
31 | ConstRender { ctx, const_, ast_node } | 31 | ConstRender { ctx, const_, ast_node } |
32 | } | 32 | } |
33 | 33 | ||
diff --git a/crates/completion/src/render/function.rs b/crates/completion/src/render/function.rs index 316e05b52..d9ea425a0 100644 --- a/crates/completion/src/render/function.rs +++ b/crates/completion/src/render/function.rs | |||
@@ -34,7 +34,7 @@ impl<'a> FunctionRender<'a> { | |||
34 | fn_: hir::Function, | 34 | fn_: hir::Function, |
35 | ) -> FunctionRender<'a> { | 35 | ) -> FunctionRender<'a> { |
36 | let name = local_name.unwrap_or_else(|| fn_.name(ctx.db()).to_string()); | 36 | let name = local_name.unwrap_or_else(|| fn_.name(ctx.db()).to_string()); |
37 | let ast_node = fn_.source(ctx.db()).value; | 37 | let ast_node = fn_.source_old(ctx.db()).value; |
38 | 38 | ||
39 | FunctionRender { ctx, name, func: fn_, ast_node } | 39 | FunctionRender { ctx, name, func: fn_, ast_node } |
40 | } | 40 | } |
diff --git a/crates/completion/src/render/macro_.rs b/crates/completion/src/render/macro_.rs index dac79592f..3d13fd9e2 100644 --- a/crates/completion/src/render/macro_.rs +++ b/crates/completion/src/render/macro_.rs | |||
@@ -96,7 +96,7 @@ impl<'a> MacroRender<'a> { | |||
96 | } | 96 | } |
97 | 97 | ||
98 | fn detail(&self) -> String { | 98 | fn detail(&self) -> String { |
99 | let ast_node = self.macro_.source(self.ctx.db()).value; | 99 | let ast_node = self.macro_.source_old(self.ctx.db()).value; |
100 | macro_label(&ast_node) | 100 | macro_label(&ast_node) |
101 | } | 101 | } |
102 | } | 102 | } |
diff --git a/crates/completion/src/render/type_alias.rs b/crates/completion/src/render/type_alias.rs index 9605c7fa9..4099a5d0e 100644 --- a/crates/completion/src/render/type_alias.rs +++ b/crates/completion/src/render/type_alias.rs | |||
@@ -27,7 +27,7 @@ struct TypeAliasRender<'a> { | |||
27 | 27 | ||
28 | impl<'a> TypeAliasRender<'a> { | 28 | impl<'a> TypeAliasRender<'a> { |
29 | fn new(ctx: RenderContext<'a>, type_alias: hir::TypeAlias) -> TypeAliasRender<'a> { | 29 | fn new(ctx: RenderContext<'a>, type_alias: hir::TypeAlias) -> TypeAliasRender<'a> { |
30 | let ast_node = type_alias.source(ctx.db()).value; | 30 | let ast_node = type_alias.source_old(ctx.db()).value; |
31 | TypeAliasRender { ctx, type_alias, ast_node } | 31 | TypeAliasRender { ctx, type_alias, ast_node } |
32 | } | 32 | } |
33 | 33 | ||