File tree 3 files changed +10
-4
lines changed
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(
1136
1136
) ;
1137
1137
result. push_str ( & header) ;
1138
1138
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 ( ) ) ) ) {
1142
1141
return None ;
1143
1142
}
1144
1143
Original file line number Diff line number Diff line change 27
27
pub trait Foo6 : /* A and C */ A + C + B { }
28
28
29
29
// Other cases
30
- trait Person {
30
+ trait Person {
31
+ fn name ( & self ) -> String ;
32
+ }
33
+ /*comment1*/ trait Person {
31
34
fn name ( & self ) -> String ;
32
35
}
33
36
trait 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 {}
24
24
trait Person {
25
25
fn name ( & self ) -> String ;
26
26
}
27
+ /*comment1*/
28
+ trait Person {
29
+ fn name ( & self ) -> String ;
30
+ }
27
31
trait Student : /* comment1 */ Person /* comment2 */ {
28
32
fn university ( & self ) -> String ;
29
33
}
You can’t perform that action at this time.
0 commit comments