Fix line break after ":" in unpretty attribute print

Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
Jonathan Brouwer
2025-07-05 22:21:28 +02:00
parent 3fa0ec91d8
commit 33f2cc7eda
3 changed files with 8 additions and 10 deletions

View File

@@ -21,7 +21,8 @@ fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream, Tok
__p.word_space(",");
}
__p.word(#string_name);
__p.word_space(":");
__p.word(":");
__p.nbsp();
__printed_anything = true;
}
#name.print_attribute(__p);

View File

@@ -9,12 +9,12 @@ extern crate std;
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]
struct PlainDeprecated;
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:
"here's why this is deprecated"}}]
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified,
note: "here's why this is deprecated"}}]
struct DirectNote;
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:
"here's why this is deprecated"}}]
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified,
note: "here's why this is deprecated"}}]
struct ExplicitNote;
#[attr = Deprecation {deprecation: Deprecation {since: NonStandard("1.2.3"),
@@ -28,8 +28,6 @@ struct FlippedOrder;
fn f() {
// Attribute is ignored here (with a warning), but still preserved in HIR
#[attr = Deprecation {deprecation:
Deprecation {since:
Unspecified}}]
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]
0
}

View File

@@ -64,8 +64,7 @@ mod attributes {
#[doc = "outer doc attribute"]
#[doc = "macro"]
#[allow()]
#[attr = Repr {reprs:
[ReprC]}]
#[attr = Repr {reprs: [ReprC]}]
struct Struct;
}