mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Simplify
This commit is contained in:
parent
1c2d4135db
commit
3d73345cdb
1 changed files with 4 additions and 11 deletions
|
@ -159,20 +159,13 @@ impl HirDisplay for ApplicationTy {
|
||||||
}
|
}
|
||||||
TypeCtor::FnDef(def) => {
|
TypeCtor::FnDef(def) => {
|
||||||
let sig = f.db.callable_item_signature(def).subst(&self.parameters);
|
let sig = f.db.callable_item_signature(def).subst(&self.parameters);
|
||||||
let name = match def {
|
match def {
|
||||||
CallableDef::FunctionId(ff) => f.db.function_data(ff).name.clone(),
|
CallableDef::FunctionId(ff) => write!(f, "fn {}", f.db.function_data(ff).name)?,
|
||||||
CallableDef::StructId(s) => f.db.struct_data(s).name.clone(),
|
CallableDef::StructId(s) => write!(f, "{}", f.db.struct_data(s).name)?,
|
||||||
CallableDef::EnumVariantId(e) => {
|
CallableDef::EnumVariantId(e) => {
|
||||||
let enum_data = f.db.enum_data(e.parent);
|
write!(f, "{}", f.db.enum_data(e.parent).variants[e.local_id].name)?
|
||||||
enum_data.variants[e.local_id].name.clone()
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
match def {
|
|
||||||
CallableDef::FunctionId(_) => write!(f, "fn {}", name)?,
|
|
||||||
CallableDef::StructId(_) | CallableDef::EnumVariantId(_) => {
|
|
||||||
write!(f, "{}", name)?
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if self.parameters.len() > 0 {
|
if self.parameters.len() > 0 {
|
||||||
let generics = generics(f.db.upcast(), def.into());
|
let generics = generics(f.db.upcast(), def.into());
|
||||||
let (parent_params, self_param, type_params, _impl_trait_params) =
|
let (parent_params, self_param, type_params, _impl_trait_params) =
|
||||||
|
|
Loading…
Reference in a new issue