aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorNick Spain <[email protected]>2021-01-01 04:02:39 +0000
committerNick Spain <[email protected]>2021-01-02 10:53:52 +0000
commitc936e4b86fd5de8e9709cd01547a69054cdec91b (patch)
treeda2e5ac682091deafecc9177b6bfa8e008541bc3 /crates
parent562e2ee28a4397878accfde014d68ab17d1b504a (diff)
source_old -> source for cases that can be handled by simple bubbling
Diffstat (limited to 'crates')
-rw-r--r--crates/assists/src/handlers/fill_match_arms.rs3
-rw-r--r--crates/assists/src/handlers/fix_visibility.rs5
-rw-r--r--crates/hir/src/code_model.rs3
-rw-r--r--crates/ide/src/diagnostics/fixes.rs6
-rw-r--r--crates/ide/src/hover.rs6
5 files changed, 10 insertions, 13 deletions
diff --git a/crates/assists/src/handlers/fill_match_arms.rs b/crates/assists/src/handlers/fill_match_arms.rs
index d17c82e18..f9a62b9fa 100644
--- a/crates/assists/src/handlers/fill_match_arms.rs
+++ b/crates/assists/src/handlers/fill_match_arms.rs
@@ -196,8 +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(db)?.value.kind() {
200 let pat: ast::Pat = match var.source_old(db).value.kind() {
201 ast::StructKind::Tuple(field_list) => { 200 ast::StructKind::Tuple(field_list) => {
202 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());
203 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 7d440d420..aa6aed9c2 100644
--- a/crates/assists/src/handlers/fix_visibility.rs
+++ b/crates/assists/src/handlers/fix_visibility.rs
@@ -98,7 +98,7 @@ fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext) ->
98 let target_module = parent.module(ctx.db()); 98 let target_module = parent.module(ctx.db());
99 99
100 #[allow(deprecated)] 100 #[allow(deprecated)]
101 let in_file_source = record_field_def.source_old(ctx.db()); 101 let in_file_source = record_field_def.source(ctx.db())?;
102 let (offset, current_visibility, target) = match in_file_source.value { 102 let (offset, current_visibility, target) = match in_file_source.value {
103 hir::FieldSource::Named(it) => { 103 hir::FieldSource::Named(it) => {
104 let s = it.syntax(); 104 let s = it.syntax();
@@ -151,8 +151,7 @@ fn target_data_for_def(
151 S: HasSource<Ast = Ast>, 151 S: HasSource<Ast = Ast>,
152 Ast: AstNode + ast::VisibilityOwner, 152 Ast: AstNode + ast::VisibilityOwner,
153 { 153 {
154 #[allow(deprecated)] 154 let source = x.source(db)?;
155 let source = x.source_old(db);
156 let in_file_syntax = source.syntax(); 155 let in_file_syntax = source.syntax();
157 let file_id = in_file_syntax.file_id; 156 let file_id = in_file_syntax.file_id;
158 let syntax = in_file_syntax.value; 157 let syntax = in_file_syntax.value;
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index 62237f481..3c83231cf 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -1372,8 +1372,7 @@ impl Impl {
1372 } 1372 }
1373 1373
1374 pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> { 1374 pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> {
1375 #[allow(deprecated)] 1375 let src = self.source(db)?;
1376 let src = self.source_old(db);
1377 let item = src.file_id.is_builtin_derive(db.upcast())?; 1376 let item = src.file_id.is_builtin_derive(db.upcast())?;
1378 let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id); 1377 let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id);
1379 1378
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index 0b5e0a4c1..ec0f840e9 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -157,7 +157,7 @@ fn missing_record_expr_field_fix(
157 VariantDef::Struct(s) => { 157 VariantDef::Struct(s) => {
158 module = s.module(sema.db); 158 module = s.module(sema.db);
159 #[allow(deprecated)] 159 #[allow(deprecated)]
160 let source = s.source_old(sema.db); 160 let source = s.source(sema.db)?;
161 def_file_id = source.file_id; 161 def_file_id = source.file_id;
162 let fields = source.value.field_list()?; 162 let fields = source.value.field_list()?;
163 record_field_list(fields)? 163 record_field_list(fields)?
@@ -165,14 +165,14 @@ fn missing_record_expr_field_fix(
165 VariantDef::Union(u) => { 165 VariantDef::Union(u) => {
166 module = u.module(sema.db); 166 module = u.module(sema.db);
167 #[allow(deprecated)] 167 #[allow(deprecated)]
168 let source = u.source_old(sema.db); 168 let source = u.source(sema.db)?;
169 def_file_id = source.file_id; 169 def_file_id = source.file_id;
170 source.value.record_field_list()? 170 source.value.record_field_list()?
171 } 171 }
172 VariantDef::Variant(e) => { 172 VariantDef::Variant(e) => {
173 module = e.module(sema.db); 173 module = e.module(sema.db);
174 #[allow(deprecated)] 174 #[allow(deprecated)]
175 let source = e.source_old(sema.db); 175 let source = e.source(sema.db)?;
176 def_file_id = source.file_id; 176 def_file_id = source.file_id;
177 let fields = source.value.field_list()?; 177 let fields = source.value.field_list()?;
178 record_field_list(fields)? 178 record_field_list(fields)?
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index a18dcdd8e..d2a0cfcd4 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -207,7 +207,7 @@ fn runnable_action(
207 }, 207 },
208 ModuleDef::Function(it) => { 208 ModuleDef::Function(it) => {
209 #[allow(deprecated)] 209 #[allow(deprecated)]
210 let src = it.source_old(sema.db); 210 let src = it.source(sema.db)?;
211 if src.file_id != file_id.into() { 211 if src.file_id != file_id.into() {
212 mark::hit!(hover_macro_generated_struct_fn_doc_comment); 212 mark::hit!(hover_macro_generated_struct_fn_doc_comment);
213 mark::hit!(hover_macro_generated_struct_fn_doc_attr); 213 mark::hit!(hover_macro_generated_struct_fn_doc_attr);
@@ -332,7 +332,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
332 } 332 }
333 Definition::Field(def) => { 333 Definition::Field(def) => {
334 #[allow(deprecated)] 334 #[allow(deprecated)]
335 let src = def.source_old(db).value; 335 let src = def.source(db)?.value;
336 if let FieldSource::Named(it) = src { 336 if let FieldSource::Named(it) = src {
337 from_def_source_labeled(db, def, it.short_label(), mod_path) 337 from_def_source_labeled(db, def, it.short_label(), mod_path)
338 } else { 338 } else {
@@ -382,7 +382,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
382 A: ShortLabel, 382 A: ShortLabel,
383 { 383 {
384 #[allow(deprecated)] 384 #[allow(deprecated)]
385 let short_label = def.source_old(db).value.short_label(); 385 let short_label = def.source(db)?.value.short_label();
386 from_def_source_labeled(db, def, short_label, mod_path) 386 from_def_source_labeled(db, def, short_label, mod_path)
387 } 387 }
388 388