diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 913341bd51..f00448081c 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs @@ -209,7 +209,6 @@ pub struct DefLoc { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub(crate) enum DefKind { - Function, Struct, Enum, EnumVariant, @@ -239,7 +238,6 @@ impl DefId { pub fn resolve(self, db: &impl HirDatabase) -> Def { let loc = self.loc(db); match loc.kind { - DefKind::Function => unreachable!(), DefKind::Struct => { let struct_def = Struct::new(self); Def::Struct(struct_def) diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index 29becd3176..274169f93d 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs @@ -77,7 +77,9 @@ impl ImplData { .impl_items() .map(|item_node| { let kind = match item_node.kind() { - ast::ImplItemKind::FnDef(..) => DefKind::Function, + ast::ImplItemKind::FnDef(it) => { + return ImplItem::Method(Function::from_ast(db, module, file_id, it)); + } ast::ImplItemKind::ConstDef(..) => DefKind::Item, ast::ImplItemKind::TypeDef(..) => DefKind::Item, }; @@ -93,9 +95,7 @@ impl ImplData { }; let def_id = def_loc.id(db); match item_node.kind() { - ast::ImplItemKind::FnDef(it) => { - ImplItem::Method(Function::from_ast(db, module, file_id, it)) - } + ast::ImplItemKind::FnDef(_) => unreachable!(), ast::ImplItemKind::ConstDef(..) => ImplItem::Const(def_id), ast::ImplItemKind::TypeDef(..) => ImplItem::Type(def_id), }