We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8f5d5c commit 8ea79aaCopy full SHA for 8ea79aa
src/types.rs
@@ -617,9 +617,12 @@ impl Rewrite for ast::Ty {
617
fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
618
match self.node {
619
ast::TyKind::TraitObject(ref bounds, tobj_syntax) => {
620
- let res = bounds.rewrite(context, shape)?;
621
// we have to consider 'dyn' keyword is used or not!!!
622
- if tobj_syntax == ast::TraitObjectSyntax::Dyn {
+ let is_dyn = tobj_syntax == ast::TraitObjectSyntax::Dyn;
+ // 4 is length of 'dyn '
623
+ let shape = if is_dyn { shape.offset_left(4)? } else { shape };
624
+ let res = bounds.rewrite(context, shape)?;
625
+ if is_dyn {
626
Some(format!("dyn {}", res))
627
} else {
628
Some(res)
0 commit comments