Rollup merge of #140762 - aDotInTheVoid:popnl, r=GuillaumeGomez

rustdoc-json: Remove newlines from attributes

Fixes #140689

Not sure if this needs to bump `FORMAT_VERSION` or not.

r? ``@GuillaumeGomez``

cc ``@obi1kenobi``
This commit is contained in:
Matthias Krüger 2025-05-08 08:14:19 +02:00 committed by GitHub
commit cd235bdec8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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(