diff options
author | Nick Spain <[email protected]> | 2021-01-01 02:50:50 +0000 |
---|---|---|
committer | Nick Spain <[email protected]> | 2021-01-02 10:53:51 +0000 |
commit | ea4708c444509449b86c50b7b1b23f9ff5af4e97 (patch) | |
tree | 2c5c5c17589f0457ba9e63b4370eb9c6951b1d87 /crates/assists/src | |
parent | 2de2b1eca3c3a3a74c0374f4de0b0c3ff25e66a9 (diff) |
Mark HasSource::source_old as deprecated but allow at all call sites
Diffstat (limited to 'crates/assists/src')
-rw-r--r-- | crates/assists/src/handlers/fill_match_arms.rs | 1 | ||||
-rw-r--r-- | crates/assists/src/handlers/fix_visibility.rs | 2 | ||||
-rw-r--r-- | crates/assists/src/utils.rs | 11 |
3 files changed, 10 insertions, 4 deletions
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 | |||
196 | let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?); | 196 | let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?); |
197 | 197 | ||
198 | // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though | 198 | // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though |
199 | #[allow(deprecated)] | ||
199 | let pat: ast::Pat = match var.source_old(db).value.kind() { | 200 | let pat: ast::Pat = match var.source_old(db).value.kind() { |
200 | ast::StructKind::Tuple(field_list) => { | 201 | ast::StructKind::Tuple(field_list) => { |
201 | let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count()); | 202 | 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) -> | |||
97 | let parent_name = parent.name(ctx.db()); | 97 | let parent_name = parent.name(ctx.db()); |
98 | let target_module = parent.module(ctx.db()); | 98 | let target_module = parent.module(ctx.db()); |
99 | 99 | ||
100 | #[allow(deprecated)] | ||
100 | let in_file_source = record_field_def.source_old(ctx.db()); | 101 | let in_file_source = record_field_def.source_old(ctx.db()); |
101 | let (offset, current_visibility, target) = match in_file_source.value { | 102 | let (offset, current_visibility, target) = match in_file_source.value { |
102 | hir::FieldSource::Named(it) => { | 103 | hir::FieldSource::Named(it) => { |
@@ -150,6 +151,7 @@ fn target_data_for_def( | |||
150 | S: HasSource<Ast = Ast>, | 151 | S: HasSource<Ast = Ast>, |
151 | Ast: AstNode + ast::VisibilityOwner, | 152 | Ast: AstNode + ast::VisibilityOwner, |
152 | { | 153 | { |
154 | #[allow(deprecated)] | ||
153 | let source = x.source_old(db); | 155 | let source = x.source_old(db); |
154 | let in_file_syntax = source.syntax(); | 156 | let in_file_syntax = source.syntax(); |
155 | let file_id = in_file_syntax.file_id; | 157 | 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( | |||
98 | 98 | ||
99 | items | 99 | items |
100 | .iter() | 100 | .iter() |
101 | .map(|i| match i { | 101 | .map(|i| { |
102 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value), | 102 | #[allow(deprecated)] |
103 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value), | 103 | match i { |
104 | hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value), | 104 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value), |
105 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value), | ||
106 | hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value), | ||
107 | } | ||
105 | }) | 108 | }) |
106 | .filter(has_def_name) | 109 | .filter(has_def_name) |
107 | .filter(|it| match it { | 110 | .filter(|it| match it { |