Don't remove where clauses in type aliases
This commit is contained in:
parent
ae9ad7b288
commit
a6b0d475f4
3 changed files with 32 additions and 0 deletions
14
src/items.rs
14
src/items.rs
|
@ -774,6 +774,20 @@ pub fn rewrite_type_alias(context: &RewriteContext,
|
|||
generics_span));
|
||||
|
||||
result.push_str(&generics_str);
|
||||
|
||||
let where_budget = try_opt!(context.config
|
||||
.max_width
|
||||
.checked_sub(last_line_width(&result)));
|
||||
let where_clause_str = try_opt!(rewrite_where_clause(context,
|
||||
&generics.where_clause,
|
||||
context.config,
|
||||
context.config.item_brace_style,
|
||||
indent,
|
||||
where_budget,
|
||||
context.config.where_density,
|
||||
"=",
|
||||
Some(span.hi)));
|
||||
result.push_str(&where_clause_str);
|
||||
result.push_str(" = ");
|
||||
|
||||
let line_width = last_line_width(&result);
|
||||
|
|
|
@ -18,3 +18,10 @@ pub type CommentTest< /* Lifetime */ 'a
|
|||
// Type
|
||||
T
|
||||
> = ();
|
||||
|
||||
|
||||
pub type WithWhereClause<LONGPARAMETERNAME, T> where T: Clone, LONGPARAMETERNAME: Clone + Eq + OtherTrait = Option<T>;
|
||||
|
||||
pub type Exactly100CharstoEqualWhereTest<T, U, PARAMET> where T: Clone + Ord + Eq + SomeOtherTrait = Option<T>;
|
||||
|
||||
pub type Exactly101CharstoEqualWhereTest<T, U, PARAMETE> where T: Clone + Ord + Eq + SomeOtherTrait = Option<T>;
|
||||
|
|
|
@ -38,3 +38,14 @@ pub type GenericsFitButNotEqualTest<'a,
|
|||
pub type CommentTest<// Lifetime
|
||||
'a, // Type
|
||||
T> = ();
|
||||
|
||||
|
||||
pub type WithWhereClause<LONGPARAMETERNAME, T>
|
||||
where T: Clone,
|
||||
LONGPARAMETERNAME: Clone + Eq + OtherTrait = Option<T>;
|
||||
|
||||
pub type Exactly100CharstoEqualWhereTest<T, U, PARAMET> where T: Clone + Ord + Eq + SomeOtherTrait =
|
||||
Option<T>;
|
||||
|
||||
pub type Exactly101CharstoEqualWhereTest<T, U, PARAMETE>
|
||||
where T: Clone + Ord + Eq + SomeOtherTrait = Option<T>;
|
||||
|
|
Loading…
Reference in a new issue