1
Fork 0

rustdoc: render unnamed arguments as underscores in cross-crate functions & function pointers

for consistency with the way we display local definitions (cleaned from HIR, not from rustc_middle).
This commit is contained in:
León Orell Valerian Liehr 2022-11-02 15:13:54 +01:00
parent 5965af7010
commit 9cdab67f6e
4 changed files with 19 additions and 16 deletions

View file

@ -1232,9 +1232,8 @@ impl clean::Arguments {
) -> impl fmt::Display + 'a + Captures<'tcx> {
display_fn(move |f| {
for (i, input) in self.values.iter().enumerate() {
if !input.name.is_empty() {
write!(f, "{}: ", input.name)?;
}
write!(f, "{}: ", input.name)?;
if f.alternate() {
write!(f, "{:#}", input.type_.print(cx))?;
} else {
@ -1367,10 +1366,8 @@ impl clean::FnDecl {
args.push_str("const ");
args_plain.push_str("const ");
}
if !input.name.is_empty() {
write!(args, "{}: ", input.name);
write!(args_plain, "{}: ", input.name);
}
write!(args, "{}: ", input.name);
write!(args_plain, "{}: ", input.name);
if f.alternate() {
write!(args, "{:#}", input.type_.print(cx));