From 27cadcd531c017aa7c78c6f7a36f2b7f2ce8a196 Mon Sep 17 00:00:00 2001 From: Nick Spain Date: Fri, 1 Jan 2021 13:05:28 +1100 Subject: HasSource::source -> HasSource::source_old To start migrating HasSource::source to return an Option. --- crates/ide/src/diagnostics/fixes.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ide/src/diagnostics') diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs index d79f5c170..702e8239d 100644 --- a/crates/ide/src/diagnostics/fixes.rs +++ b/crates/ide/src/diagnostics/fixes.rs @@ -156,20 +156,20 @@ fn missing_record_expr_field_fix( let record_fields = match VariantDef::from(def_id) { VariantDef::Struct(s) => { module = s.module(sema.db); - let source = s.source(sema.db); + let source = s.source_old(sema.db); def_file_id = source.file_id; let fields = source.value.field_list()?; record_field_list(fields)? } VariantDef::Union(u) => { module = u.module(sema.db); - let source = u.source(sema.db); + let source = u.source_old(sema.db); def_file_id = source.file_id; source.value.record_field_list()? } VariantDef::Variant(e) => { module = e.module(sema.db); - let source = e.source(sema.db); + let source = e.source_old(sema.db); def_file_id = source.file_id; let fields = source.value.field_list()?; record_field_list(fields)? -- cgit v1.2.3 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/ide/src/diagnostics/fixes.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/ide/src/diagnostics') 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( let record_fields = match VariantDef::from(def_id) { VariantDef::Struct(s) => { module = s.module(sema.db); + #[allow(deprecated)] let source = s.source_old(sema.db); def_file_id = source.file_id; let fields = source.value.field_list()?; @@ -163,12 +164,14 @@ fn missing_record_expr_field_fix( } VariantDef::Union(u) => { module = u.module(sema.db); + #[allow(deprecated)] let source = u.source_old(sema.db); def_file_id = source.file_id; source.value.record_field_list()? } VariantDef::Variant(e) => { module = e.module(sema.db); + #[allow(deprecated)] let source = e.source_old(sema.db); def_file_id = source.file_id; let fields = source.value.field_list()?; -- cgit v1.2.3 From c936e4b86fd5de8e9709cd01547a69054cdec91b Mon Sep 17 00:00:00 2001 From: Nick Spain Date: Fri, 1 Jan 2021 15:02:39 +1100 Subject: source_old -> source for cases that can be handled by simple bubbling --- crates/ide/src/diagnostics/fixes.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ide/src/diagnostics') 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( VariantDef::Struct(s) => { module = s.module(sema.db); #[allow(deprecated)] - let source = s.source_old(sema.db); + let source = s.source(sema.db)?; def_file_id = source.file_id; let fields = source.value.field_list()?; record_field_list(fields)? @@ -165,14 +165,14 @@ fn missing_record_expr_field_fix( VariantDef::Union(u) => { module = u.module(sema.db); #[allow(deprecated)] - let source = u.source_old(sema.db); + let source = u.source(sema.db)?; def_file_id = source.file_id; source.value.record_field_list()? } VariantDef::Variant(e) => { module = e.module(sema.db); #[allow(deprecated)] - let source = e.source_old(sema.db); + let source = e.source(sema.db)?; def_file_id = source.file_id; let fields = source.value.field_list()?; record_field_list(fields)? -- cgit v1.2.3