diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2024-10-29 02:34:25 +0100 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2024-11-13 16:03:57 +0100 |
| commit | 9016711bf1f43db68f0ba51a9852b65a2270ae61 (patch) | |
| tree | 907224bb7632d344311c227079f71c0769f8a3b8 /src/librustdoc/clean/utils.rs | |
| parent | 143ce0920a2307b19831160a01f06f107610f1b2 (diff) | |
| download | rust-9016711bf1f43db68f0ba51a9852b65a2270ae61.tar.gz rust-9016711bf1f43db68f0ba51a9852b65a2270ae61.zip | |
rustdoc: Treat decl macros like other items
Diffstat (limited to 'src/librustdoc/clean/utils.rs')
| -rw-r--r-- | src/librustdoc/clean/utils.rs | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 560831197f0..a2e52185153 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -24,7 +24,6 @@ use crate::clean::{ clean_middle_ty, inline, }; use crate::core::DocContext; -use crate::html::format::visibility_to_src_with_space; #[cfg(test)] mod tests; @@ -599,7 +598,7 @@ pub(crate) static DOC_CHANNEL: Lazy<&'static str> = /// Render a sequence of macro arms in a format suitable for displaying to the user /// as part of an item declaration. -pub(super) fn render_macro_arms<'a>( +fn render_macro_arms<'a>( tcx: TyCtxt<'_>, matchers: impl Iterator<Item = &'a TokenTree>, arm_delim: &str, @@ -620,9 +619,6 @@ pub(super) fn display_macro_source( cx: &mut DocContext<'_>, name: Symbol, def: &ast::MacroDef, - def_id: DefId, - vis: ty::Visibility<DefId>, - is_doc_hidden: bool, ) -> String { // Extract the spans of all matchers. They represent the "interface" of the macro. let matchers = def.body.tokens.chunks(4).map(|arm| &arm[0]); @@ -632,18 +628,13 @@ pub(super) fn display_macro_source( } else { if matchers.len() <= 1 { format!( - "{vis}macro {name}{matchers} {{\n ...\n}}", - vis = visibility_to_src_with_space(Some(vis), cx.tcx, def_id, is_doc_hidden), + "macro {name}{matchers} {{\n ...\n}}", matchers = matchers .map(|matcher| render_macro_matcher(cx.tcx, matcher)) .collect::<String>(), ) } else { - format!( - "{vis}macro {name} {{\n{arms}}}", - vis = visibility_to_src_with_space(Some(vis), cx.tcx, def_id, is_doc_hidden), - arms = render_macro_arms(cx.tcx, matchers, ","), - ) + format!("macro {name} {{\n{arms}}}", arms = render_macro_arms(cx.tcx, matchers, ",")) } } } |
