@@ -221,7 +221,16 @@ impl HirDisplay for ApplicationTy {
221221 }
222222 TypeCtor :: RawPtr ( m) => {
223223 let t = self . parameters . as_single ( ) ;
224- write ! ( f, "*{}{}" , m. as_keyword_for_ptr( ) , t. display( f. db) ) ?;
224+ let ty_display = t. display ( f. db ) ;
225+
226+ write ! ( f, "*{}" , m. as_keyword_for_ptr( ) ) ?;
227+ if matches ! ( t, Ty :: Dyn ( predicates) if predicates. len( ) > 1 ) {
228+ write ! ( f, "(" ) ?;
229+ write ! ( f, "{}" , ty_display) ?;
230+ write ! ( f, ")" ) ?;
231+ } else {
232+ write ! ( f, "{}" , ty_display) ?;
233+ }
225234 }
226235 TypeCtor :: Ref ( m) => {
227236 let t = self . parameters . as_single ( ) ;
@@ -230,7 +239,15 @@ impl HirDisplay for ApplicationTy {
230239 } else {
231240 t. display ( f. db )
232241 } ;
233- write ! ( f, "&{}{}" , m. as_keyword_for_ref( ) , ty_display) ?;
242+
243+ write ! ( f, "&{}" , m. as_keyword_for_ref( ) ) ?;
244+ if matches ! ( t, Ty :: Dyn ( predicates) if predicates. len( ) > 1 ) {
245+ write ! ( f, "(" ) ?;
246+ write ! ( f, "{}" , ty_display) ?;
247+ write ! ( f, ")" ) ?;
248+ } else {
249+ write ! ( f, "{}" , ty_display) ?;
250+ }
234251 }
235252 TypeCtor :: Never => write ! ( f, "!" ) ?,
236253 TypeCtor :: Tuple { .. } => {
@@ -636,14 +653,14 @@ impl HirDisplay for GenericPredicate {
636653
637654impl HirDisplay for Obligation {
638655 fn hir_fmt ( & self , f : & mut HirFormatter ) -> Result < ( ) , HirDisplayError > {
639- Ok ( match self {
640- Obligation :: Trait ( tr) => write ! ( f, "Implements({})" , tr. display( f. db) ) ? ,
656+ match self {
657+ Obligation :: Trait ( tr) => write ! ( f, "Implements({})" , tr. display( f. db) ) ,
641658 Obligation :: Projection ( proj) => write ! (
642659 f,
643660 "Normalize({} => {})" ,
644661 proj. projection_ty. display( f. db) ,
645662 proj. ty. display( f. db)
646- ) ? ,
647- } )
663+ ) ,
664+ }
648665 }
649666}
0 commit comments