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/assists | |
parent | aa3ce16f2641b7eb562a8eae67738b0ff0c0b7b0 (diff) |
HasSource::source -> HasSource::source_old
To start migrating HasSource::source to return an Option.
Diffstat (limited to 'crates/assists')
-rw-r--r-- | crates/assists/src/handlers/fill_match_arms.rs | 2 | ||||
-rw-r--r-- | crates/assists/src/handlers/fix_visibility.rs | 4 | ||||
-rw-r--r-- | crates/assists/src/utils.rs | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/crates/assists/src/handlers/fill_match_arms.rs b/crates/assists/src/handlers/fill_match_arms.rs index cb60a3128..a8efad6d6 100644 --- a/crates/assists/src/handlers/fill_match_arms.rs +++ b/crates/assists/src/handlers/fill_match_arms.rs | |||
@@ -196,7 +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 | let pat: ast::Pat = match var.source(db).value.kind() { | 199 | let pat: ast::Pat = match var.source_old(db).value.kind() { |
200 | ast::StructKind::Tuple(field_list) => { | 200 | ast::StructKind::Tuple(field_list) => { |
201 | let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count()); | 201 | let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count()); |
202 | make::tuple_struct_pat(path, pats).into() | 202 | make::tuple_struct_pat(path, pats).into() |
diff --git a/crates/assists/src/handlers/fix_visibility.rs b/crates/assists/src/handlers/fix_visibility.rs index 8558a8ff0..d8150abd9 100644 --- a/crates/assists/src/handlers/fix_visibility.rs +++ b/crates/assists/src/handlers/fix_visibility.rs | |||
@@ -97,7 +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 | let in_file_source = record_field_def.source(ctx.db()); | 100 | let in_file_source = record_field_def.source_old(ctx.db()); |
101 | let (offset, current_visibility, target) = match in_file_source.value { | 101 | let (offset, current_visibility, target) = match in_file_source.value { |
102 | hir::FieldSource::Named(it) => { | 102 | hir::FieldSource::Named(it) => { |
103 | let s = it.syntax(); | 103 | let s = it.syntax(); |
@@ -150,7 +150,7 @@ fn target_data_for_def( | |||
150 | S: HasSource<Ast = Ast>, | 150 | S: HasSource<Ast = Ast>, |
151 | Ast: AstNode + ast::VisibilityOwner, | 151 | Ast: AstNode + ast::VisibilityOwner, |
152 | { | 152 | { |
153 | let source = x.source(db); | 153 | let source = x.source_old(db); |
154 | let in_file_syntax = source.syntax(); | 154 | let in_file_syntax = source.syntax(); |
155 | let file_id = in_file_syntax.file_id; | 155 | let file_id = in_file_syntax.file_id; |
156 | let syntax = in_file_syntax.value; | 156 | let syntax = in_file_syntax.value; |
diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs index d41084b59..7ee7111ae 100644 --- a/crates/assists/src/utils.rs +++ b/crates/assists/src/utils.rs | |||
@@ -99,9 +99,9 @@ pub fn filter_assoc_items( | |||
99 | items | 99 | items |
100 | .iter() | 100 | .iter() |
101 | .map(|i| match i { | 101 | .map(|i| match i { |
102 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(db).value), | 102 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value), |
103 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(db).value), | 103 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value), |
104 | hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source(db).value), | 104 | hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value), |
105 | }) | 105 | }) |
106 | .filter(has_def_name) | 106 | .filter(has_def_name) |
107 | .filter(|it| match it { | 107 | .filter(|it| match it { |