From 887028fcf52bf7f3af55114f112123c902989bed Mon Sep 17 00:00:00 2001 From: Nick Spain Date: Sat, 2 Jan 2021 16:25:36 +1100 Subject: Remove old_source now we've fully migrated Fixes #6913 --- crates/hir/src/has_source.rs | 68 -------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'crates/hir') diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs index 8a7306def..57baeb3cf 100644 --- a/crates/hir/src/has_source.rs +++ b/crates/hir/src/has_source.rs @@ -16,8 +16,6 @@ use crate::{ pub trait HasSource { type Ast; - #[deprecated = "migrating to source() method that returns an Option"] - fn source_old(self, db: &dyn HirDatabase) -> InFile; fn source(self, db: &dyn HirDatabase) -> Option>; } @@ -48,15 +46,6 @@ impl Module { impl HasSource for Field { type Ast = FieldSource; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - let var = VariantId::from(self.parent); - let src = var.child_source(db.upcast()); - src.map(|it| match it[self.id].clone() { - Either::Left(it) => FieldSource::Pos(it), - Either::Right(it) => FieldSource::Named(it), - }) - } - fn source(self, db: &dyn HirDatabase) -> Option> { let var = VariantId::from(self.parent); let src = var.child_source(db.upcast()); @@ -69,103 +58,60 @@ impl HasSource for Field { } impl HasSource for Struct { type Ast = ast::Struct; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.id.lookup(db.upcast()).source(db.upcast()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.id.lookup(db.upcast()).source(db.upcast())) } } impl HasSource for Union { type Ast = ast::Union; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.id.lookup(db.upcast()).source(db.upcast()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.id.lookup(db.upcast()).source(db.upcast())) } } impl HasSource for Enum { type Ast = ast::Enum; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.id.lookup(db.upcast()).source(db.upcast()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.id.lookup(db.upcast()).source(db.upcast())) } } impl HasSource for Variant { type Ast = ast::Variant; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone())) } } impl HasSource for Function { type Ast = ast::Fn; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.id.lookup(db.upcast()).source(db.upcast()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.id.lookup(db.upcast()).source(db.upcast())) } } impl HasSource for Const { type Ast = ast::Const; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.id.lookup(db.upcast()).source(db.upcast()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.id.lookup(db.upcast()).source(db.upcast())) } } impl HasSource for Static { type Ast = ast::Static; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.id.lookup(db.upcast()).source(db.upcast()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.id.lookup(db.upcast()).source(db.upcast())) } } impl HasSource for Trait { type Ast = ast::Trait; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.id.lookup(db.upcast()).source(db.upcast()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.id.lookup(db.upcast()).source(db.upcast())) } } impl HasSource for TypeAlias { type Ast = ast::TypeAlias; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.id.lookup(db.upcast()).source(db.upcast()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.id.lookup(db.upcast()).source(db.upcast())) } } impl HasSource for MacroDef { type Ast = ast::Macro; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - InFile { - file_id: self.id.ast_id.expect("MacroDef without ast_id").file_id, - value: self.id.ast_id.expect("MacroDef without ast_id").to_node(db.upcast()), - } - } - fn source(self, db: &dyn HirDatabase) -> Option> { let ast_id = self.id.ast_id?; Some(InFile { file_id: ast_id.file_id, value: ast_id.to_node(db.upcast()) }) @@ -173,10 +119,6 @@ impl HasSource for MacroDef { } impl HasSource for Impl { type Ast = ast::Impl; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - self.id.lookup(db.upcast()).source(db.upcast()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { Some(self.id.lookup(db.upcast()).source(db.upcast())) } @@ -184,11 +126,6 @@ impl HasSource for Impl { impl HasSource for TypeParam { type Ast = Either; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - let child_source = self.id.parent.child_source(db.upcast()); - child_source.map(|it| it[self.id.local_id].clone()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { let child_source = self.id.parent.child_source(db.upcast()); Some(child_source.map(|it| it[self.id.local_id].clone())) @@ -197,11 +134,6 @@ impl HasSource for TypeParam { impl HasSource for LifetimeParam { type Ast = ast::LifetimeParam; - fn source_old(self, db: &dyn HirDatabase) -> InFile { - let child_source = self.id.parent.child_source(db.upcast()); - child_source.map(|it| it[self.id.local_id].clone()) - } - fn source(self, db: &dyn HirDatabase) -> Option> { let child_source = self.id.parent.child_source(db.upcast()); Some(child_source.map(|it| it[self.id.local_id].clone())) -- cgit v1.2.3