1
Fork 0

Rewrite foreign item kind query using DefKind

This commit is contained in:
Mohammad Omidvar 2024-02-14 17:38:36 +00:00
parent 213748749e
commit 2e691a5c12
4 changed files with 16 additions and 24 deletions

View file

@ -71,7 +71,7 @@ pub trait Context {
fn is_foreign_item(&self, item: DefId) -> bool;
/// Returns the kind of a given foreign item.
fn foreign_item_kind(&self, def: ForeignDef) -> Option<ForeignItemKind>;
fn foreign_item_kind(&self, def: ForeignDef) -> ForeignItemKind;
/// Returns the kind of a given algebraic data type
fn adt_kind(&self, def: AdtDef) -> AdtKind;

View file

@ -566,7 +566,7 @@ crate_def! {
}
impl ForeignDef {
pub fn kind(&self) -> Option<ForeignItemKind> {
pub fn kind(&self) -> ForeignItemKind {
with(|cx| cx.foreign_item_kind(*self))
}
}