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/ide/src | |
parent | 2de2b1eca3c3a3a74c0374f4de0b0c3ff25e66a9 (diff) |
Mark HasSource::source_old as deprecated but allow at all call sites
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/diagnostics/fixes.rs | 3 | ||||
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 6 | ||||
-rw-r--r-- | crates/ide/src/hover.rs | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs index 702e8239d..0b5e0a4c1 100644 --- a/crates/ide/src/diagnostics/fixes.rs +++ b/crates/ide/src/diagnostics/fixes.rs | |||
@@ -156,6 +156,7 @@ fn missing_record_expr_field_fix( | |||
156 | let record_fields = match VariantDef::from(def_id) { | 156 | let record_fields = match VariantDef::from(def_id) { |
157 | VariantDef::Struct(s) => { | 157 | VariantDef::Struct(s) => { |
158 | module = s.module(sema.db); | 158 | module = s.module(sema.db); |
159 | #[allow(deprecated)] | ||
159 | let source = s.source_old(sema.db); | 160 | let source = s.source_old(sema.db); |
160 | def_file_id = source.file_id; | 161 | def_file_id = source.file_id; |
161 | let fields = source.value.field_list()?; | 162 | let fields = source.value.field_list()?; |
@@ -163,12 +164,14 @@ fn missing_record_expr_field_fix( | |||
163 | } | 164 | } |
164 | VariantDef::Union(u) => { | 165 | VariantDef::Union(u) => { |
165 | module = u.module(sema.db); | 166 | module = u.module(sema.db); |
167 | #[allow(deprecated)] | ||
166 | let source = u.source_old(sema.db); | 168 | let source = u.source_old(sema.db); |
167 | def_file_id = source.file_id; | 169 | def_file_id = source.file_id; |
168 | source.value.record_field_list()? | 170 | source.value.record_field_list()? |
169 | } | 171 | } |
170 | VariantDef::Variant(e) => { | 172 | VariantDef::Variant(e) => { |
171 | module = e.module(sema.db); | 173 | module = e.module(sema.db); |
174 | #[allow(deprecated)] | ||
172 | let source = e.source_old(sema.db); | 175 | let source = e.source_old(sema.db); |
173 | def_file_id = source.file_id; | 176 | def_file_id = source.file_id; |
174 | let fields = source.value.field_list()?; | 177 | let fields = source.value.field_list()?; |
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index de4c0fa12..efa0418ad 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs | |||
@@ -285,6 +285,7 @@ where | |||
285 | D::Ast: ast::NameOwner + ShortLabel, | 285 | D::Ast: ast::NameOwner + ShortLabel, |
286 | { | 286 | { |
287 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 287 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { |
288 | #[allow(deprecated)] | ||
288 | let src = self.source_old(db); | 289 | let src = self.source_old(db); |
289 | let mut res = NavigationTarget::from_named( | 290 | let mut res = NavigationTarget::from_named( |
290 | db, | 291 | db, |
@@ -314,6 +315,7 @@ impl ToNav for hir::Module { | |||
314 | 315 | ||
315 | impl ToNav for hir::Impl { | 316 | impl ToNav for hir::Impl { |
316 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 317 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { |
318 | #[allow(deprecated)] | ||
317 | let src = self.source_old(db); | 319 | let src = self.source_old(db); |
318 | let derive_attr = self.is_builtin_derive(db); | 320 | let derive_attr = self.is_builtin_derive(db); |
319 | let frange = if let Some(item) = &derive_attr { | 321 | let frange = if let Some(item) = &derive_attr { |
@@ -339,6 +341,7 @@ impl ToNav for hir::Impl { | |||
339 | 341 | ||
340 | impl ToNav for hir::Field { | 342 | impl ToNav for hir::Field { |
341 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 343 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { |
344 | #[allow(deprecated)] | ||
342 | let src = self.source_old(db); | 345 | let src = self.source_old(db); |
343 | 346 | ||
344 | match &src.value { | 347 | match &src.value { |
@@ -365,6 +368,7 @@ impl ToNav for hir::Field { | |||
365 | 368 | ||
366 | impl ToNav for hir::MacroDef { | 369 | impl ToNav for hir::MacroDef { |
367 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 370 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { |
371 | #[allow(deprecated)] | ||
368 | let src = self.source_old(db); | 372 | let src = self.source_old(db); |
369 | log::debug!("nav target {:#?}", src.value.syntax()); | 373 | log::debug!("nav target {:#?}", src.value.syntax()); |
370 | let mut res = NavigationTarget::from_named( | 374 | let mut res = NavigationTarget::from_named( |
@@ -448,6 +452,7 @@ impl ToNav for hir::Label { | |||
448 | 452 | ||
449 | impl ToNav for hir::TypeParam { | 453 | impl ToNav for hir::TypeParam { |
450 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 454 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { |
455 | #[allow(deprecated)] | ||
451 | let src = self.source_old(db); | 456 | let src = self.source_old(db); |
452 | let full_range = match &src.value { | 457 | let full_range = match &src.value { |
453 | Either::Left(it) => it.syntax().text_range(), | 458 | Either::Left(it) => it.syntax().text_range(), |
@@ -472,6 +477,7 @@ impl ToNav for hir::TypeParam { | |||
472 | 477 | ||
473 | impl ToNav for hir::LifetimeParam { | 478 | impl ToNav for hir::LifetimeParam { |
474 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 479 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { |
480 | #[allow(deprecated)] | ||
475 | let src = self.source_old(db); | 481 | let src = self.source_old(db); |
476 | let full_range = src.value.syntax().text_range(); | 482 | let full_range = src.value.syntax().text_range(); |
477 | NavigationTarget { | 483 | NavigationTarget { |
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 90781ea34..c192e3ed7 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -206,6 +206,7 @@ fn runnable_action( | |||
206 | _ => None, | 206 | _ => None, |
207 | }, | 207 | }, |
208 | ModuleDef::Function(it) => { | 208 | ModuleDef::Function(it) => { |
209 | #[allow(deprecated)] | ||
209 | let src = it.source_old(sema.db); | 210 | let src = it.source_old(sema.db); |
210 | if src.file_id != file_id.into() { | 211 | if src.file_id != file_id.into() { |
211 | mark::hit!(hover_macro_generated_struct_fn_doc_comment); | 212 | mark::hit!(hover_macro_generated_struct_fn_doc_comment); |
@@ -332,10 +333,12 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> { | |||
332 | if it.is_proc_macro() { | 333 | if it.is_proc_macro() { |
333 | return None; | 334 | return None; |
334 | } | 335 | } |
336 | #[allow(deprecated)] | ||
335 | let label = macro_label(&it.source_old(db).value); | 337 | let label = macro_label(&it.source_old(db).value); |
336 | from_def_source_labeled(db, it, Some(label), mod_path) | 338 | from_def_source_labeled(db, it, Some(label), mod_path) |
337 | } | 339 | } |
338 | Definition::Field(def) => { | 340 | Definition::Field(def) => { |
341 | #[allow(deprecated)] | ||
339 | let src = def.source_old(db).value; | 342 | let src = def.source_old(db).value; |
340 | if let FieldSource::Named(it) = src { | 343 | if let FieldSource::Named(it) = src { |
341 | from_def_source_labeled(db, def, it.short_label(), mod_path) | 344 | from_def_source_labeled(db, def, it.short_label(), mod_path) |
@@ -385,6 +388,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> { | |||
385 | D: HasSource<Ast = A> + HasAttrs + Copy, | 388 | D: HasSource<Ast = A> + HasAttrs + Copy, |
386 | A: ShortLabel, | 389 | A: ShortLabel, |
387 | { | 390 | { |
391 | #[allow(deprecated)] | ||
388 | let short_label = def.source_old(db).value.short_label(); | 392 | let short_label = def.source_old(db).value.short_label(); |
389 | from_def_source_labeled(db, def, short_label, mod_path) | 393 | from_def_source_labeled(db, def, short_label, mod_path) |
390 | } | 394 | } |