Skip to content

Commit 33f2cc7

Browse files
Fix line break after ":" in unpretty attribute print
Signed-off-by: Jonathan Brouwer <[email protected]>
1 parent 3fa0ec9 commit 33f2cc7

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

compiler/rustc_macros/src/print_attribute.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream, Tok
2121
__p.word_space(",");
2222
}
2323
__p.word(#string_name);
24-
__p.word_space(":");
24+
__p.word(":");
25+
__p.nbsp();
2526
__printed_anything = true;
2627
}
2728
#name.print_attribute(__p);

tests/ui/unpretty/deprecated-attr.stdout

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ extern crate std;
99
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]
1010
struct PlainDeprecated;
1111

12-
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:
13-
"here's why this is deprecated"}}]
12+
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified,
13+
note: "here's why this is deprecated"}}]
1414
struct DirectNote;
1515

16-
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:
17-
"here's why this is deprecated"}}]
16+
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified,
17+
note: "here's why this is deprecated"}}]
1818
struct ExplicitNote;
1919

2020
#[attr = Deprecation {deprecation: Deprecation {since: NonStandard("1.2.3"),
@@ -28,8 +28,6 @@ struct FlippedOrder;
2828
fn f() {
2929

3030
// Attribute is ignored here (with a warning), but still preserved in HIR
31-
#[attr = Deprecation {deprecation:
32-
Deprecation {since:
33-
Unspecified}}]
31+
#[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]
3432
0
3533
}

tests/ui/unpretty/exhaustive.hir.stdout

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ mod attributes {
6464
#[doc = "outer doc attribute"]
6565
#[doc = "macro"]
6666
#[allow()]
67-
#[attr = Repr {reprs:
68-
[ReprC]}]
67+
#[attr = Repr {reprs: [ReprC]}]
6968
struct Struct;
7069
}
7170

0 commit comments

Comments
 (0)