File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -1136,9 +1136,8 @@ pub(crate) fn format_trait(
11361136 ) ;
11371137 result. push_str ( & header) ;
11381138
1139- // FIXME: rustfmt fails to format when there are comments between `trait` and ident.
1140- let trait_hi = context. snippet_provider . span_after ( item. span , "trait" ) ;
1141- if contains_comment ( context. snippet ( mk_sp ( trait_hi, generics. span . lo ( ) ) ) ) {
1139+ // FIXME: rustfmt fails to format when there are comments before the ident.
1140+ if contains_comment ( context. snippet ( mk_sp ( item. span . lo ( ) , generics. span . lo ( ) ) ) ) {
11421141 return None ;
11431142 }
11441143
Original file line number Diff line number Diff line change 2727pub trait Foo6 : /* A and C */ A + C + B { }
2828
2929// Other cases
30- trait Person {
30+ trait Person {
31+ fn name ( & self ) -> String ;
32+ }
33+ /*comment1*/ trait Person {
3134fn name ( & self ) -> String ;
3235}
3336trait Student : /* comment1 */ Person /* comment2 */ {
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ pub trait Foo6: /* A and C */ A + C + B {}
2424trait Person {
2525 fn name ( & self ) -> String ;
2626}
27+ /*comment1*/
28+ trait Person {
29+ fn name ( & self ) -> String ;
30+ }
2731trait Student : /* comment1 */ Person /* comment2 */ {
2832 fn university ( & self ) -> String ;
2933}
You can’t perform that action at this time.
0 commit comments