mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Use lang-item instead of db lookup for FnTrait
kind
This commit is contained in:
parent
46cdce1b53
commit
a4021f6ed5
2 changed files with 10 additions and 9 deletions
|
@ -217,6 +217,15 @@ impl FnTrait {
|
|||
}
|
||||
}
|
||||
|
||||
pub const fn from_lang_item(lang_item: LangItem) -> Option<Self> {
|
||||
match lang_item {
|
||||
LangItem::FnOnce => Some(FnTrait::FnOnce),
|
||||
LangItem::FnMut => Some(FnTrait::FnMut),
|
||||
LangItem::Fn => Some(FnTrait::Fn),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn to_chalk_ir(self) -> rust_ir::ClosureKind {
|
||||
match self {
|
||||
FnTrait::FnOnce => rust_ir::ClosureKind::FnOnce,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue