honor type_punctuation_density for assoc. types

This commit is contained in:
Alex Burka 2017-02-22 15:11:16 -05:00
parent 4f939ddf0c
commit 181cde9afb

View File

@ -161,7 +161,10 @@ impl<'a> Rewrite for SegmentParam<'a> {
SegmentParam::LifeTime(lt) => lt.rewrite(context, shape),
SegmentParam::Type(ty) => ty.rewrite(context, shape),
SegmentParam::Binding(binding) => {
let mut result = format!("{} = ", binding.ident);
let mut result = match context.config.type_punctuation_density {
TypeDensity::Wide => format!("{} = ", binding.ident),
TypeDensity::Compressed => format!("{}=", binding.ident),
};
let budget = try_opt!(shape.width.checked_sub(result.len()));
let rewrite = try_opt!(binding.ty
.rewrite(context, Shape::legacy(budget, shape.indent + result.len())));