From ea4708c444509449b86c50b7b1b23f9ff5af4e97 Mon Sep 17 00:00:00 2001 From: Nick Spain Date: Fri, 1 Jan 2021 13:50:50 +1100 Subject: Mark HasSource::source_old as deprecated but allow at all call sites --- crates/assists/src/handlers/fill_match_arms.rs | 1 + crates/assists/src/handlers/fix_visibility.rs | 2 ++ crates/assists/src/utils.rs | 11 +++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'crates/assists') diff --git a/crates/assists/src/handlers/fill_match_arms.rs b/crates/assists/src/handlers/fill_match_arms.rs index a8efad6d6..d17c82e18 100644 --- a/crates/assists/src/handlers/fill_match_arms.rs +++ b/crates/assists/src/handlers/fill_match_arms.rs @@ -196,6 +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))?); // 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_old(db).value.kind() { ast::StructKind::Tuple(field_list) => { let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count()); diff --git a/crates/assists/src/handlers/fix_visibility.rs b/crates/assists/src/handlers/fix_visibility.rs index d8150abd9..7d440d420 100644 --- a/crates/assists/src/handlers/fix_visibility.rs +++ b/crates/assists/src/handlers/fix_visibility.rs @@ -97,6 +97,7 @@ fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext) -> let parent_name = parent.name(ctx.db()); let target_module = parent.module(ctx.db()); + #[allow(deprecated)] let in_file_source = record_field_def.source_old(ctx.db()); let (offset, current_visibility, target) = match in_file_source.value { hir::FieldSource::Named(it) => { @@ -150,6 +151,7 @@ fn target_data_for_def( S: HasSource, Ast: AstNode + ast::VisibilityOwner, { + #[allow(deprecated)] let source = x.source_old(db); let in_file_syntax = source.syntax(); let file_id = in_file_syntax.file_id; diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs index 7ee7111ae..d15e5a24b 100644 --- a/crates/assists/src/utils.rs +++ b/crates/assists/src/utils.rs @@ -98,10 +98,13 @@ pub fn filter_assoc_items( items .iter() - .map(|i| match i { - hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value), - hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value), - hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value), + .map(|i| { + #[allow(deprecated)] + match i { + hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value), + hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value), + hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value), + } }) .filter(has_def_name) .filter(|it| match it { -- cgit v1.2.3