diff --git a/src/items.rs b/src/items.rs index 2c4570a3a759..4e10d0c47572 100644 --- a/src/items.rs +++ b/src/items.rs @@ -1862,6 +1862,9 @@ pub(crate) fn rewrite_type_alias( let lhs = format!("{}=", prefix); rewrite_assign_rhs(context, lhs, &**ty, shape).map(|s| s + ";") } else { + if !generics.where_clause.predicates.is_empty() { + prefix.push_str(&indent.to_string_with_newline(context.config)); + } Some(format!("{};", prefix)) } } diff --git a/tests/target/issue-4159.rs b/tests/target/issue-4159.rs index 52abb132cae8..fed6095354a0 100644 --- a/tests/target/issue-4159.rs +++ b/tests/target/issue-4159.rs @@ -3,11 +3,13 @@ extern "C" { type A<'a> where - 'a: 'static,; + 'a: 'static, + ; type A where - T: 'static,; + T: 'static, + ; type A = u8;