Use offset_left()
This commit is contained in:
parent
6e41100725
commit
1b84623aac
1 changed files with 6 additions and 8 deletions
14
src/types.rs
14
src/types.rs
|
@ -439,7 +439,7 @@ impl Rewrite for ast::WherePredicate {
|
|||
|
||||
// 6 = "for<> ".len()
|
||||
let used_width = lifetime_str.len() + type_str.len() + colon.len() + 6;
|
||||
let ty_shape = try_opt!(shape.block_left(used_width));
|
||||
let ty_shape = try_opt!(shape.offset_left(used_width));
|
||||
let bounds: Vec<_> = try_opt!(
|
||||
bounds
|
||||
.iter()
|
||||
|
@ -553,10 +553,9 @@ impl Rewrite for ast::TyParamBound {
|
|||
tref.rewrite(context, shape)
|
||||
}
|
||||
ast::TyParamBound::TraitTyParamBound(ref tref, ast::TraitBoundModifier::Maybe) => {
|
||||
let budget = try_opt!(shape.width.checked_sub(1));
|
||||
Some(format!(
|
||||
"?{}",
|
||||
try_opt!(tref.rewrite(context, Shape::legacy(budget, shape.indent + 1)))
|
||||
try_opt!(tref.rewrite(context, try_opt!(shape.offset_left(1))))
|
||||
))
|
||||
}
|
||||
ast::TyParamBound::RegionTyParamBound(ref l) => l.rewrite(context, shape),
|
||||
|
@ -624,11 +623,10 @@ impl Rewrite for ast::PolyTraitRef {
|
|||
|
||||
// 6 is "for<> ".len()
|
||||
let extra_offset = lifetime_str.len() + 6;
|
||||
let max_path_width = try_opt!(shape.width.checked_sub(extra_offset));
|
||||
let path_str = try_opt!(self.trait_ref.rewrite(
|
||||
context,
|
||||
Shape::legacy(max_path_width, shape.indent + extra_offset),
|
||||
));
|
||||
let path_str = try_opt!(
|
||||
self.trait_ref
|
||||
.rewrite(context, try_opt!(shape.offset_left(extra_offset)))
|
||||
);
|
||||
|
||||
Some(
|
||||
if context.config.spaces_within_angle_brackets() && !lifetime_str.is_empty() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue