rustdoc-json: Remove newlines from attributes

This commit is contained in:
Alona Enraght-Moony 2025-05-07 18:45:58 +00:00
parent 1a95cc6f9d
commit aeb70c710a
9 changed files with 17 additions and 13 deletions

View file

@ -786,7 +786,11 @@ impl Item {
// because it isn't public API.
None
}
_ => Some(rustc_hir_pretty::attribute_to_string(&tcx, attr)),
_ => Some({
let mut s = rustc_hir_pretty::attribute_to_string(&tcx, attr);
assert_eq!(s.pop(), Some('\n'));
s
}),
}
} else if attr.has_any_name(ALLOWED_ATTRIBUTES) {
Some(