hir-ty: change struct constructor formatting.

before, when formatting struct constructor for `struct S(usize, usize)` it would format as:

    extern "rust-call" S(usize, usize) -> S

but after this change, we'll format as:

    fn S(usize, usize) -> S
This commit is contained in:
Jake 2024-10-08 11:05:03 -07:00
parent efaf8bd5de
commit 5cba3e72bc
No known key found for this signature in database
6 changed files with 54 additions and 53 deletions

View file

@ -1008,7 +1008,7 @@ impl HirDisplay for Ty {
if let Safety::Unsafe = sig.safety {
write!(f, "unsafe ")?;
}
if !matches!(sig.abi, FnAbi::Rust) {
if !matches!(sig.abi, FnAbi::Rust | FnAbi::RustCall) {
f.write_str("extern \"")?;
f.write_str(sig.abi.as_str())?;
f.write_str("\" ")?;
@ -1025,6 +1025,7 @@ impl HirDisplay for Ty {
)?
}
CallableDefId::StructId(s) => {
write!(f, "fn ")?;
f.start_location_link(def.into());
write!(f, "{}", db.struct_data(s).name.display(f.db.upcast(), f.edition()))?
}