mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
source_old -> source for cases that can be handled by simple bubbling
This commit is contained in:
parent
562e2ee28a
commit
c936e4b86f
5 changed files with 10 additions and 13 deletions
|
@ -196,8 +196,7 @@ fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::Variant) -> Optio
|
||||||
let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?);
|
let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?);
|
||||||
|
|
||||||
// FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though
|
// FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though
|
||||||
#[allow(deprecated)]
|
let pat: ast::Pat = match var.source(db)?.value.kind() {
|
||||||
let pat: ast::Pat = match var.source_old(db).value.kind() {
|
|
||||||
ast::StructKind::Tuple(field_list) => {
|
ast::StructKind::Tuple(field_list) => {
|
||||||
let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count());
|
let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count());
|
||||||
make::tuple_struct_pat(path, pats).into()
|
make::tuple_struct_pat(path, pats).into()
|
||||||
|
|
|
@ -98,7 +98,7 @@ fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext) ->
|
||||||
let target_module = parent.module(ctx.db());
|
let target_module = parent.module(ctx.db());
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
let in_file_source = record_field_def.source_old(ctx.db());
|
let in_file_source = record_field_def.source(ctx.db())?;
|
||||||
let (offset, current_visibility, target) = match in_file_source.value {
|
let (offset, current_visibility, target) = match in_file_source.value {
|
||||||
hir::FieldSource::Named(it) => {
|
hir::FieldSource::Named(it) => {
|
||||||
let s = it.syntax();
|
let s = it.syntax();
|
||||||
|
@ -151,8 +151,7 @@ fn target_data_for_def(
|
||||||
S: HasSource<Ast = Ast>,
|
S: HasSource<Ast = Ast>,
|
||||||
Ast: AstNode + ast::VisibilityOwner,
|
Ast: AstNode + ast::VisibilityOwner,
|
||||||
{
|
{
|
||||||
#[allow(deprecated)]
|
let source = x.source(db)?;
|
||||||
let source = x.source_old(db);
|
|
||||||
let in_file_syntax = source.syntax();
|
let in_file_syntax = source.syntax();
|
||||||
let file_id = in_file_syntax.file_id;
|
let file_id = in_file_syntax.file_id;
|
||||||
let syntax = in_file_syntax.value;
|
let syntax = in_file_syntax.value;
|
||||||
|
|
|
@ -1372,8 +1372,7 @@ impl Impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> {
|
pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> {
|
||||||
#[allow(deprecated)]
|
let src = self.source(db)?;
|
||||||
let src = self.source_old(db);
|
|
||||||
let item = src.file_id.is_builtin_derive(db.upcast())?;
|
let item = src.file_id.is_builtin_derive(db.upcast())?;
|
||||||
let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id);
|
let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id);
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ fn missing_record_expr_field_fix(
|
||||||
VariantDef::Struct(s) => {
|
VariantDef::Struct(s) => {
|
||||||
module = s.module(sema.db);
|
module = s.module(sema.db);
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
let source = s.source_old(sema.db);
|
let source = s.source(sema.db)?;
|
||||||
def_file_id = source.file_id;
|
def_file_id = source.file_id;
|
||||||
let fields = source.value.field_list()?;
|
let fields = source.value.field_list()?;
|
||||||
record_field_list(fields)?
|
record_field_list(fields)?
|
||||||
|
@ -165,14 +165,14 @@ fn missing_record_expr_field_fix(
|
||||||
VariantDef::Union(u) => {
|
VariantDef::Union(u) => {
|
||||||
module = u.module(sema.db);
|
module = u.module(sema.db);
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
let source = u.source_old(sema.db);
|
let source = u.source(sema.db)?;
|
||||||
def_file_id = source.file_id;
|
def_file_id = source.file_id;
|
||||||
source.value.record_field_list()?
|
source.value.record_field_list()?
|
||||||
}
|
}
|
||||||
VariantDef::Variant(e) => {
|
VariantDef::Variant(e) => {
|
||||||
module = e.module(sema.db);
|
module = e.module(sema.db);
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
let source = e.source_old(sema.db);
|
let source = e.source(sema.db)?;
|
||||||
def_file_id = source.file_id;
|
def_file_id = source.file_id;
|
||||||
let fields = source.value.field_list()?;
|
let fields = source.value.field_list()?;
|
||||||
record_field_list(fields)?
|
record_field_list(fields)?
|
||||||
|
|
|
@ -207,7 +207,7 @@ fn runnable_action(
|
||||||
},
|
},
|
||||||
ModuleDef::Function(it) => {
|
ModuleDef::Function(it) => {
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
let src = it.source_old(sema.db);
|
let src = it.source(sema.db)?;
|
||||||
if src.file_id != file_id.into() {
|
if src.file_id != file_id.into() {
|
||||||
mark::hit!(hover_macro_generated_struct_fn_doc_comment);
|
mark::hit!(hover_macro_generated_struct_fn_doc_comment);
|
||||||
mark::hit!(hover_macro_generated_struct_fn_doc_attr);
|
mark::hit!(hover_macro_generated_struct_fn_doc_attr);
|
||||||
|
@ -332,7 +332,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
|
||||||
}
|
}
|
||||||
Definition::Field(def) => {
|
Definition::Field(def) => {
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
let src = def.source_old(db).value;
|
let src = def.source(db)?.value;
|
||||||
if let FieldSource::Named(it) = src {
|
if let FieldSource::Named(it) = src {
|
||||||
from_def_source_labeled(db, def, it.short_label(), mod_path)
|
from_def_source_labeled(db, def, it.short_label(), mod_path)
|
||||||
} else {
|
} else {
|
||||||
|
@ -382,7 +382,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
|
||||||
A: ShortLabel,
|
A: ShortLabel,
|
||||||
{
|
{
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
let short_label = def.source_old(db).value.short_label();
|
let short_label = def.source(db)?.value.short_label();
|
||||||
from_def_source_labeled(db, def, short_label, mod_path)
|
from_def_source_labeled(db, def, short_label, mod_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue