File tree 3 files changed +11
-2
lines changed
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1197,14 +1197,15 @@ pub(crate) fn format_trait(
1197
1197
}
1198
1198
result. push ( '{' ) ;
1199
1199
1200
- let snippet = context. snippet ( item. span ) ;
1200
+ let block_span = mk_sp ( generics. where_clause . span . hi ( ) , item. span . hi ( ) ) ;
1201
+ let snippet = context. snippet ( block_span) ;
1201
1202
let open_pos = snippet. find_uncommented ( "{" ) ? + 1 ;
1202
1203
let outer_indent_str = offset. block_only ( ) . to_string_with_newline ( context. config ) ;
1203
1204
1204
1205
if !trait_items. is_empty ( ) || contains_comment ( & snippet[ open_pos..] ) {
1205
1206
let mut visitor = FmtVisitor :: from_context ( context) ;
1206
1207
visitor. block_indent = offset. block_only ( ) . block_indent ( context. config ) ;
1207
- visitor. last_pos = item . span . lo ( ) + BytePos ( open_pos as u32 ) ;
1208
+ visitor. last_pos = block_span . lo ( ) + BytePos ( open_pos as u32 ) ;
1208
1209
1209
1210
for item in trait_items {
1210
1211
visitor. visit_trait_item ( item) ;
Original file line number Diff line number Diff line change @@ -30,3 +30,7 @@ fn foo<const X: usize>() {
30
30
}
31
31
32
32
type Foo < const N : usize > = [ i32 ; N + 1 ] ;
33
+
34
+ pub trait Foo : Bar < { Baz :: COUNT } > {
35
+ const ASD : usize ;
36
+ }
Original file line number Diff line number Diff line change @@ -22,3 +22,7 @@ fn foo<const X: usize>() {
22
22
}
23
23
24
24
type Foo < const N : usize > = [ i32 ; N + 1 ] ;
25
+
26
+ pub trait Foo : Bar < { Baz :: COUNT } > {
27
+ const ASD : usize ;
28
+ }
You can’t perform that action at this time.
0 commit comments