1
Fork 0

rustdoc: Clean Visibility outside of display_macro_source

This change should make the code a bit clearer and easier to change.
This commit is contained in:
Noah Lev 2021-11-12 13:40:20 -08:00
parent 41301c3b23
commit 7a7698aa1b
3 changed files with 9 additions and 13 deletions

View file

@ -529,7 +529,7 @@ pub(super) fn display_macro_source(
name: Symbol,
def: &ast::MacroDef,
def_id: DefId,
vis: impl Clean<Visibility>,
vis: Visibility,
) -> String {
let tts: Vec<_> = def.body.inner_tokens().into_trees().collect();
// Extract the spans of all matchers. They represent the "interface" of the macro.
@ -538,8 +538,6 @@ pub(super) fn display_macro_source(
if def.macro_rules {
format!("macro_rules! {} {{\n{}}}", name, render_macro_arms(matchers, ";"))
} else {
let vis = vis.clean(cx);
if matchers.len() <= 1 {
format!(
"{}macro {}{} {{\n ...\n}}",