From 70600fe6d9173800e12a2bc735636ffad0123dba Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Tue, 26 Aug 2025 11:33:31 +0100 Subject: [PATCH] Rust: Remove unused traits and things. --- rust/extractor/src/translate/mappings.rs | 118 ----------------------- 1 file changed, 118 deletions(-) diff --git a/rust/extractor/src/translate/mappings.rs b/rust/extractor/src/translate/mappings.rs index 3e71c6deb14..1900e4227b8 100644 --- a/rust/extractor/src/translate/mappings.rs +++ b/rust/extractor/src/translate/mappings.rs @@ -66,124 +66,6 @@ impl TextValue for ast::RangePat { } } -pub(crate) trait AddressableHir: HasContainer + Copy { - fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option; - fn try_from_source(value: &Ast, sema: &Semantics<'_, RootDatabase>) -> Option; - fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module; -} - -impl AddressableHir for Function { - fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option { - Some(self.name(sema.db).as_str().to_owned()) - } - - fn try_from_source(value: &ast::Fn, sema: &Semantics<'_, RootDatabase>) -> Option { - sema.to_fn_def(value) - } - - fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module { - self.module(sema.db) - } -} - -impl AddressableHir for Trait { - fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option { - Some(self.name(sema.db).as_str().to_owned()) - } - - fn try_from_source(value: &ast::Trait, sema: &Semantics<'_, RootDatabase>) -> Option { - sema.to_trait_def(value) - } - - fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module { - self.module(sema.db) - } -} - -impl AddressableHir for Module { - fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option { - self.name(sema.db).map(|s| s.as_str().to_owned()) - } - - fn try_from_source(value: &ast::Module, sema: &Semantics<'_, RootDatabase>) -> Option { - sema.to_module_def(value) - } - - fn module(self, _sema: &Semantics<'_, RootDatabase>) -> Module { - self - } -} - -impl AddressableHir for Struct { - fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option { - Some(self.name(sema.db).as_str().to_owned()) - } - - fn try_from_source(value: &ast::Struct, sema: &Semantics<'_, RootDatabase>) -> Option { - sema.to_struct_def(value) - } - - fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module { - self.module(sema.db) - } -} - -impl AddressableHir for Enum { - fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option { - Some(self.name(sema.db).as_str().to_owned()) - } - - fn try_from_source(value: &ast::Enum, sema: &Semantics<'_, RootDatabase>) -> Option { - sema.to_enum_def(value) - } - - fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module { - self.module(sema.db) - } -} - -impl AddressableHir for Union { - fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option { - Some(self.name(sema.db).as_str().to_owned()) - } - - fn try_from_source(value: &ast::Union, sema: &Semantics<'_, RootDatabase>) -> Option { - sema.to_union_def(value) - } - - fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module { - self.module(sema.db) - } -} - -pub(crate) trait AddressableAst: AstNode + Sized { - type Hir: AddressableHir; -} - -impl AddressableAst for ast::Fn { - type Hir = Function; -} - -impl AddressableAst for ast::Trait { - type Hir = Trait; -} - -impl AddressableAst for ast::Struct { - type Hir = Struct; -} - -impl AddressableAst for ast::Enum { - type Hir = Enum; -} - -impl AddressableAst for ast::Union { - type Hir = Union; -} - -impl AddressableAst for ast::Module { - type Hir = Module; -} - pub trait PathAst: AstNode { fn path(&self) -> Option; }