aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-02 18:03:32 +0000
committerAleksey Kladov <[email protected]>2020-03-02 18:03:46 +0000
commit1a6f51da66f16a46eb5fd80dc6ea0a2c179d5ff2 (patch)
tree27f3bad75ee1fcbad9ee6e1af8d9305b9c8efa62 /crates/ra_ide_db
parent2716a1fa3f8a7410248724a6ce5d4c28837db682 (diff)
Simplify: remove couple of useless functions
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r--crates/ra_ide_db/src/defs.rs30
1 files changed, 11 insertions, 19 deletions
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index ad4638906..7b1030a14 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -111,47 +111,47 @@ fn classify_name_inner(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Opti
111 }, 111 },
112 ast::RecordFieldDef(it) => { 112 ast::RecordFieldDef(it) => {
113 let field: hir::StructField = sema.to_def(&it)?; 113 let field: hir::StructField = sema.to_def(&it)?;
114 Some(from_struct_field(field)) 114 Some(NameDefinition::StructField(field))
115 }, 115 },
116 ast::Module(it) => { 116 ast::Module(it) => {
117 let def = sema.to_def(&it)?; 117 let def = sema.to_def(&it)?;
118 Some(from_module_def(def.into())) 118 Some(NameDefinition::ModuleDef(def.into()))
119 }, 119 },
120 ast::StructDef(it) => { 120 ast::StructDef(it) => {
121 let def: hir::Struct = sema.to_def(&it)?; 121 let def: hir::Struct = sema.to_def(&it)?;
122 Some(from_module_def(def.into())) 122 Some(NameDefinition::ModuleDef(def.into()))
123 }, 123 },
124 ast::UnionDef(it) => { 124 ast::UnionDef(it) => {
125 let def: hir::Union = sema.to_def(&it)?; 125 let def: hir::Union = sema.to_def(&it)?;
126 Some(from_module_def(def.into())) 126 Some(NameDefinition::ModuleDef(def.into()))
127 }, 127 },
128 ast::EnumDef(it) => { 128 ast::EnumDef(it) => {
129 let def: hir::Enum = sema.to_def(&it)?; 129 let def: hir::Enum = sema.to_def(&it)?;
130 Some(from_module_def(def.into())) 130 Some(NameDefinition::ModuleDef(def.into()))
131 }, 131 },
132 ast::TraitDef(it) => { 132 ast::TraitDef(it) => {
133 let def: hir::Trait = sema.to_def(&it)?; 133 let def: hir::Trait = sema.to_def(&it)?;
134 Some(from_module_def(def.into())) 134 Some(NameDefinition::ModuleDef(def.into()))
135 }, 135 },
136 ast::StaticDef(it) => { 136 ast::StaticDef(it) => {
137 let def: hir::Static = sema.to_def(&it)?; 137 let def: hir::Static = sema.to_def(&it)?;
138 Some(from_module_def(def.into())) 138 Some(NameDefinition::ModuleDef(def.into()))
139 }, 139 },
140 ast::EnumVariant(it) => { 140 ast::EnumVariant(it) => {
141 let def: hir::EnumVariant = sema.to_def(&it)?; 141 let def: hir::EnumVariant = sema.to_def(&it)?;
142 Some(from_module_def(def.into())) 142 Some(NameDefinition::ModuleDef(def.into()))
143 }, 143 },
144 ast::FnDef(it) => { 144 ast::FnDef(it) => {
145 let def: hir::Function = sema.to_def(&it)?; 145 let def: hir::Function = sema.to_def(&it)?;
146 Some(from_module_def(def.into())) 146 Some(NameDefinition::ModuleDef(def.into()))
147 }, 147 },
148 ast::ConstDef(it) => { 148 ast::ConstDef(it) => {
149 let def: hir::Const = sema.to_def(&it)?; 149 let def: hir::Const = sema.to_def(&it)?;
150 Some(from_module_def(def.into())) 150 Some(NameDefinition::ModuleDef(def.into()))
151 }, 151 },
152 ast::TypeAliasDef(it) => { 152 ast::TypeAliasDef(it) => {
153 let def: hir::TypeAlias = sema.to_def(&it)?; 153 let def: hir::TypeAlias = sema.to_def(&it)?;
154 Some(from_module_def(def.into())) 154 Some(NameDefinition::ModuleDef(def.into()))
155 }, 155 },
156 ast::MacroCall(it) => { 156 ast::MacroCall(it) => {
157 let def = sema.to_def(&it)?; 157 let def = sema.to_def(&it)?;
@@ -165,11 +165,3 @@ fn classify_name_inner(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Opti
165 } 165 }
166 } 166 }
167} 167}
168
169pub fn from_struct_field(field: StructField) -> NameDefinition {
170 NameDefinition::StructField(field)
171}
172
173pub fn from_module_def(def: ModuleDef) -> NameDefinition {
174 NameDefinition::ModuleDef(def)
175}