mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
HasSource::source -> HasSource::source_old
To start migrating HasSource::source to return an Option.
This commit is contained in:
parent
aa3ce16f26
commit
27cadcd531
15 changed files with 55 additions and 55 deletions
|
@ -156,7 +156,7 @@ fn add_function_impl(
|
|||
};
|
||||
let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end());
|
||||
|
||||
let function_decl = function_declaration(&func.source(ctx.db).value);
|
||||
let function_decl = function_declaration(&func.source_old(ctx.db).value);
|
||||
match ctx.config.snippet_cap {
|
||||
Some(cap) => {
|
||||
let snippet = format!("{} {{\n $0\n}}", function_decl);
|
||||
|
@ -200,7 +200,7 @@ fn add_const_impl(
|
|||
let const_name = const_.name(ctx.db).map(|n| n.to_string());
|
||||
|
||||
if let Some(const_name) = const_name {
|
||||
let snippet = make_const_compl_syntax(&const_.source(ctx.db).value);
|
||||
let snippet = make_const_compl_syntax(&const_.source_old(ctx.db).value);
|
||||
|
||||
let range = TextRange::new(const_def_node.text_range().start(), ctx.source_range().end());
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ struct ConstRender<'a> {
|
|||
|
||||
impl<'a> ConstRender<'a> {
|
||||
fn new(ctx: RenderContext<'a>, const_: hir::Const) -> ConstRender<'a> {
|
||||
let ast_node = const_.source(ctx.db()).value;
|
||||
let ast_node = const_.source_old(ctx.db()).value;
|
||||
ConstRender { ctx, const_, ast_node }
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ impl<'a> FunctionRender<'a> {
|
|||
fn_: hir::Function,
|
||||
) -> FunctionRender<'a> {
|
||||
let name = local_name.unwrap_or_else(|| fn_.name(ctx.db()).to_string());
|
||||
let ast_node = fn_.source(ctx.db()).value;
|
||||
let ast_node = fn_.source_old(ctx.db()).value;
|
||||
|
||||
FunctionRender { ctx, name, func: fn_, ast_node }
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ impl<'a> MacroRender<'a> {
|
|||
}
|
||||
|
||||
fn detail(&self) -> String {
|
||||
let ast_node = self.macro_.source(self.ctx.db()).value;
|
||||
let ast_node = self.macro_.source_old(self.ctx.db()).value;
|
||||
macro_label(&ast_node)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ struct TypeAliasRender<'a> {
|
|||
|
||||
impl<'a> TypeAliasRender<'a> {
|
||||
fn new(ctx: RenderContext<'a>, type_alias: hir::TypeAlias) -> TypeAliasRender<'a> {
|
||||
let ast_node = type_alias.source(ctx.db()).value;
|
||||
let ast_node = type_alias.source_old(ctx.db()).value;
|
||||
TypeAliasRender { ctx, type_alias, ast_node }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue