]> git.lizzy.rs Git - rust.git/commitdiff
source_old -> source for cases that can be handled by simple bubbling
authorNick Spain <nicholas.spain@stileeducation.com>
Fri, 1 Jan 2021 04:02:39 +0000 (15:02 +1100)
committerNick Spain <nicholas.spain@stileeducation.com>
Sat, 2 Jan 2021 10:53:52 +0000 (21:53 +1100)
crates/assists/src/handlers/fill_match_arms.rs
crates/assists/src/handlers/fix_visibility.rs
crates/hir/src/code_model.rs
crates/ide/src/diagnostics/fixes.rs
crates/ide/src/hover.rs

index d17c82e18a5316d3fa6039ed602403fbfe3bb134..f9a62b9facd54e722696517ed4773c93891c7d50 100644 (file)
@@ -196,8 +196,7 @@ fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::Variant) -> Optio
     let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?);
 
     // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though
-    #[allow(deprecated)]
-    let pat: ast::Pat = match var.source_old(db).value.kind() {
+    let pat: ast::Pat = match var.source(db)?.value.kind() {
         ast::StructKind::Tuple(field_list) => {
             let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count());
             make::tuple_struct_pat(path, pats).into()
index 7d440d4206bdd5fbab0f4422e8c043aea453369c..aa6aed9c24c9c18ae329b6a349c5f8a9d986e0fe 100644 (file)
@@ -98,7 +98,7 @@ fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext) ->
     let target_module = parent.module(ctx.db());
 
     #[allow(deprecated)]
-    let in_file_source = record_field_def.source_old(ctx.db());
+    let in_file_source = record_field_def.source(ctx.db())?;
     let (offset, current_visibility, target) = match in_file_source.value {
         hir::FieldSource::Named(it) => {
             let s = it.syntax();
@@ -151,8 +151,7 @@ fn offset_target_and_file_id<S, Ast>(
         S: HasSource<Ast = Ast>,
         Ast: AstNode + ast::VisibilityOwner,
     {
-        #[allow(deprecated)]
-        let source = x.source_old(db);
+        let source = x.source(db)?;
         let in_file_syntax = source.syntax();
         let file_id = in_file_syntax.file_id;
         let syntax = in_file_syntax.value;
index 62237f481723d61da8eb91728a05f98cd1df71d8..3c83231cf1c32d8a4ab3cbc83670fa0f919714cd 100644 (file)
@@ -1372,8 +1372,7 @@ pub fn krate(self, db: &dyn HirDatabase) -> Crate {
     }
 
     pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> {
-        #[allow(deprecated)]
-        let src = self.source_old(db);
+        let src = self.source(db)?;
         let item = src.file_id.is_builtin_derive(db.upcast())?;
         let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id);
 
index 0b5e0a4c174de24878f436efb16d17089c55418a..ec0f840e9d726550f3dd9c1c647c0f375c32a917 100644 (file)
@@ -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)?
index a18dcdd8e20a189f2b01762c79229a1098d479e8..d2a0cfcd402e0ce48741e8a09924ab141a5d1903 100644 (file)
@@ -207,7 +207,7 @@ fn runnable_action(
             },
             ModuleDef::Function(it) => {
                 #[allow(deprecated)]
-                let src = it.source_old(sema.db);
+                let src = it.source(sema.db)?;
                 if src.file_id != file_id.into() {
                     mark::hit!(hover_macro_generated_struct_fn_doc_comment);
                     mark::hit!(hover_macro_generated_struct_fn_doc_attr);
@@ -332,7 +332,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
         }
         Definition::Field(def) => {
             #[allow(deprecated)]
-            let src = def.source_old(db).value;
+            let src = def.source(db)?.value;
             if let FieldSource::Named(it) = src {
                 from_def_source_labeled(db, def, it.short_label(), mod_path)
             } else {
@@ -382,7 +382,7 @@ fn from_def_source<A, D>(db: &RootDatabase, def: D, mod_path: Option<String>) ->
         A: ShortLabel,
     {
         #[allow(deprecated)]
-        let short_label = def.source_old(db).value.short_label();
+        let short_label = def.source(db)?.value.short_label();
         from_def_source_labeled(db, def, short_label, mod_path)
     }