Skip to content

Commit 731f7d5

Browse files
fix: handling of associated type bounds
1 parent e0e2f0d commit 731f7d5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/types.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,22 @@ impl<'a> Rewrite for SegmentParam<'a> {
168168
SegmentParam::LifeTime(lt) => lt.rewrite(context, shape),
169169
SegmentParam::Type(ty) => ty.rewrite(context, shape),
170170
SegmentParam::Binding(assoc_ty_constraint) => {
171-
let mut result = match context.config.type_punctuation_density() {
172-
TypeDensity::Wide => {
173-
format!("{} = ", rewrite_ident(context, assoc_ty_constraint.ident))
171+
let mut result = match assoc_ty_constraint.kind {
172+
ast::AssocTyConstraintKind::Bound { .. } => {
173+
format!("{}: ", rewrite_ident(context, assoc_ty_constraint.ident))
174174
}
175-
TypeDensity::Compressed => {
176-
format!("{}=", rewrite_ident(context, assoc_ty_constraint.ident))
175+
ast::AssocTyConstraintKind::Equality { .. } => {
176+
match context.config.type_punctuation_density() {
177+
TypeDensity::Wide => {
178+
format!("{} = ", rewrite_ident(context, assoc_ty_constraint.ident))
179+
}
180+
TypeDensity::Compressed => {
181+
format!("{}=", rewrite_ident(context, assoc_ty_constraint.ident))
182+
}
183+
}
177184
}
178185
};
186+
179187
let budget = shape.width.checked_sub(result.len())?;
180188
let rewrite = assoc_ty_constraint
181189
.kind

0 commit comments

Comments
 (0)