Skip to content

Commit 70600fe

Browse files
committed
Rust: Remove unused traits and things.
1 parent bd5f863 commit 70600fe

File tree

1 file changed

+0
-118
lines changed

1 file changed

+0
-118
lines changed

rust/extractor/src/translate/mappings.rs

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -66,124 +66,6 @@ impl TextValue for ast::RangePat {
6666
}
6767
}
6868

69-
pub(crate) trait AddressableHir<Ast: AstNode>: HasContainer + Copy {
70-
fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option<String>;
71-
fn try_from_source(value: &Ast, sema: &Semantics<'_, RootDatabase>) -> Option<Self>;
72-
fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module;
73-
}
74-
75-
impl AddressableHir<ast::Fn> for Function {
76-
fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option<String> {
77-
Some(self.name(sema.db).as_str().to_owned())
78-
}
79-
80-
fn try_from_source(value: &ast::Fn, sema: &Semantics<'_, RootDatabase>) -> Option<Self> {
81-
sema.to_fn_def(value)
82-
}
83-
84-
fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module {
85-
self.module(sema.db)
86-
}
87-
}
88-
89-
impl AddressableHir<ast::Trait> for Trait {
90-
fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option<String> {
91-
Some(self.name(sema.db).as_str().to_owned())
92-
}
93-
94-
fn try_from_source(value: &ast::Trait, sema: &Semantics<'_, RootDatabase>) -> Option<Self> {
95-
sema.to_trait_def(value)
96-
}
97-
98-
fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module {
99-
self.module(sema.db)
100-
}
101-
}
102-
103-
impl AddressableHir<ast::Module> for Module {
104-
fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option<String> {
105-
self.name(sema.db).map(|s| s.as_str().to_owned())
106-
}
107-
108-
fn try_from_source(value: &ast::Module, sema: &Semantics<'_, RootDatabase>) -> Option<Self> {
109-
sema.to_module_def(value)
110-
}
111-
112-
fn module(self, _sema: &Semantics<'_, RootDatabase>) -> Module {
113-
self
114-
}
115-
}
116-
117-
impl AddressableHir<ast::Struct> for Struct {
118-
fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option<String> {
119-
Some(self.name(sema.db).as_str().to_owned())
120-
}
121-
122-
fn try_from_source(value: &ast::Struct, sema: &Semantics<'_, RootDatabase>) -> Option<Self> {
123-
sema.to_struct_def(value)
124-
}
125-
126-
fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module {
127-
self.module(sema.db)
128-
}
129-
}
130-
131-
impl AddressableHir<ast::Enum> for Enum {
132-
fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option<String> {
133-
Some(self.name(sema.db).as_str().to_owned())
134-
}
135-
136-
fn try_from_source(value: &ast::Enum, sema: &Semantics<'_, RootDatabase>) -> Option<Self> {
137-
sema.to_enum_def(value)
138-
}
139-
140-
fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module {
141-
self.module(sema.db)
142-
}
143-
}
144-
145-
impl AddressableHir<ast::Union> for Union {
146-
fn name(self, sema: &Semantics<'_, RootDatabase>) -> Option<String> {
147-
Some(self.name(sema.db).as_str().to_owned())
148-
}
149-
150-
fn try_from_source(value: &ast::Union, sema: &Semantics<'_, RootDatabase>) -> Option<Self> {
151-
sema.to_union_def(value)
152-
}
153-
154-
fn module(self, sema: &Semantics<'_, RootDatabase>) -> Module {
155-
self.module(sema.db)
156-
}
157-
}
158-
159-
pub(crate) trait AddressableAst: AstNode + Sized {
160-
type Hir: AddressableHir<Self>;
161-
}
162-
163-
impl AddressableAst for ast::Fn {
164-
type Hir = Function;
165-
}
166-
167-
impl AddressableAst for ast::Trait {
168-
type Hir = Trait;
169-
}
170-
171-
impl AddressableAst for ast::Struct {
172-
type Hir = Struct;
173-
}
174-
175-
impl AddressableAst for ast::Enum {
176-
type Hir = Enum;
177-
}
178-
179-
impl AddressableAst for ast::Union {
180-
type Hir = Union;
181-
}
182-
183-
impl AddressableAst for ast::Module {
184-
type Hir = Module;
185-
}
186-
18769
pub trait PathAst: AstNode {
18870
fn path(&self) -> Option<ast::Path>;
18971
}

0 commit comments

Comments
 (0)