mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
remove DefKind::Function
This commit is contained in:
parent
ec7ed054e0
commit
1754dd9fdd
@ -209,7 +209,6 @@ pub struct DefLoc {
|
|||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
pub(crate) enum DefKind {
|
pub(crate) enum DefKind {
|
||||||
Function,
|
|
||||||
Struct,
|
Struct,
|
||||||
Enum,
|
Enum,
|
||||||
EnumVariant,
|
EnumVariant,
|
||||||
@ -239,7 +238,6 @@ impl DefId {
|
|||||||
pub fn resolve(self, db: &impl HirDatabase) -> Def {
|
pub fn resolve(self, db: &impl HirDatabase) -> Def {
|
||||||
let loc = self.loc(db);
|
let loc = self.loc(db);
|
||||||
match loc.kind {
|
match loc.kind {
|
||||||
DefKind::Function => unreachable!(),
|
|
||||||
DefKind::Struct => {
|
DefKind::Struct => {
|
||||||
let struct_def = Struct::new(self);
|
let struct_def = Struct::new(self);
|
||||||
Def::Struct(struct_def)
|
Def::Struct(struct_def)
|
||||||
|
@ -77,7 +77,9 @@ impl ImplData {
|
|||||||
.impl_items()
|
.impl_items()
|
||||||
.map(|item_node| {
|
.map(|item_node| {
|
||||||
let kind = match item_node.kind() {
|
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::ConstDef(..) => DefKind::Item,
|
||||||
ast::ImplItemKind::TypeDef(..) => DefKind::Item,
|
ast::ImplItemKind::TypeDef(..) => DefKind::Item,
|
||||||
};
|
};
|
||||||
@ -93,9 +95,7 @@ impl ImplData {
|
|||||||
};
|
};
|
||||||
let def_id = def_loc.id(db);
|
let def_id = def_loc.id(db);
|
||||||
match item_node.kind() {
|
match item_node.kind() {
|
||||||
ast::ImplItemKind::FnDef(it) => {
|
ast::ImplItemKind::FnDef(_) => unreachable!(),
|
||||||
ImplItem::Method(Function::from_ast(db, module, file_id, it))
|
|
||||||
}
|
|
||||||
ast::ImplItemKind::ConstDef(..) => ImplItem::Const(def_id),
|
ast::ImplItemKind::ConstDef(..) => ImplItem::Const(def_id),
|
||||||
ast::ImplItemKind::TypeDef(..) => ImplItem::Type(def_id),
|
ast::ImplItemKind::TypeDef(..) => ImplItem::Type(def_id),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user