add offset_left(4) for 'dyn '
This commit is contained in:
parent
f8f5d5c68c
commit
8ea79aa025
1 changed files with 5 additions and 2 deletions
|
@ -617,9 +617,12 @@ impl Rewrite for ast::Ty {
|
|||
fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
|
||||
match self.node {
|
||||
ast::TyKind::TraitObject(ref bounds, tobj_syntax) => {
|
||||
let res = bounds.rewrite(context, shape)?;
|
||||
// we have to consider 'dyn' keyword is used or not!!!
|
||||
if tobj_syntax == ast::TraitObjectSyntax::Dyn {
|
||||
let is_dyn = tobj_syntax == ast::TraitObjectSyntax::Dyn;
|
||||
// 4 is length of 'dyn '
|
||||
let shape = if is_dyn { shape.offset_left(4)? } else { shape };
|
||||
let res = bounds.rewrite(context, shape)?;
|
||||
if is_dyn {
|
||||
Some(format!("dyn {}", res))
|
||||
} else {
|
||||
Some(res)
|
||||
|
|
Loading…
Reference in a new issue