From 9cdab67f6e3f249e677abf3580637fe42324a961 Mon Sep 17 00:00:00 2001 From: León Orell Valerian Liehr Date: Wed, 2 Nov 2022 15:13:54 +0100 Subject: 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). --- src/librustdoc/html/format.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/librustdoc/html') diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 06db3fb0ec4..a5c3d35b1b5 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -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)); -- cgit 1.4.1-3-g733a5