Skip to content

Commit a9b0b05

Browse files
ayazhafizcalebcartwright
authored andcommitted
fixup! Preserve and format type aliases in extern blocks
1 parent a15800a commit a9b0b05

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/items.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,6 +1862,9 @@ pub(crate) fn rewrite_type_alias(
18621862
let lhs = format!("{}=", prefix);
18631863
rewrite_assign_rhs(context, lhs, &**ty, shape).map(|s| s + ";")
18641864
} else {
1865+
if !generics.where_clause.predicates.is_empty() {
1866+
prefix.push_str(&indent.to_string_with_newline(context.config));
1867+
}
18651868
Some(format!("{};", prefix))
18661869
}
18671870
}

tests/target/issue-4159.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ extern "C" {
33

44
type A<'a>
55
where
6-
'a: 'static,;
6+
'a: 'static,
7+
;
78

89
type A<T: Ord>
910
where
10-
T: 'static,;
11+
T: 'static,
12+
;
1113

1214
type A = u8;
1315

0 commit comments

Comments
 (0)