mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Show TyKind::FnDef
as a fn pointer in source code
This commit is contained in:
parent
037844c8a0
commit
b517aeeca5
3 changed files with 27 additions and 2 deletions
|
@ -885,6 +885,13 @@ impl HirDisplay for Ty {
|
|||
TyKind::FnDef(def, parameters) => {
|
||||
let def = from_chalk(db, *def);
|
||||
let sig = db.callable_item_signature(def).substitute(Interner, parameters);
|
||||
|
||||
if f.display_target.is_source_code() {
|
||||
// `FnDef` is anonymous and there's no surface syntax for it. Show it as a
|
||||
// function pointer type.
|
||||
return sig.hir_fmt(f);
|
||||
}
|
||||
|
||||
f.start_location_link(def.into());
|
||||
match def {
|
||||
CallableDefId::FunctionId(ff) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue