File tree 2 files changed +15
-10
lines changed
2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ use std::str;
42
42
use std:: string:: ToString ;
43
43
use std:: sync:: Arc ;
44
44
45
+ use itertools:: Itertools ;
45
46
use rustc_ast_pretty:: pprust;
46
47
use rustc_data_structures:: flock;
47
48
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
@@ -3203,15 +3204,19 @@ const ATTRIBUTE_WHITELIST: &[Symbol] = &[
3203
3204
// bar: usize,
3204
3205
// }
3205
3206
fn render_attributes ( w : & mut Buffer , it : & clean:: Item , top : bool ) {
3206
- let mut attrs = String :: new ( ) ;
3207
-
3208
- for attr in & it. attrs . other_attrs {
3209
- if !ATTRIBUTE_WHITELIST . contains ( & attr. name_or_empty ( ) ) {
3210
- continue ;
3211
- }
3207
+ let attrs = it
3208
+ . attrs
3209
+ . other_attrs
3210
+ . iter ( )
3211
+ . filter_map ( |attr| {
3212
+ if ATTRIBUTE_WHITELIST . contains ( & attr. name_or_empty ( ) ) {
3213
+ Some ( pprust:: attribute_to_string ( & attr) )
3214
+ } else {
3215
+ None
3216
+ }
3217
+ } )
3218
+ . join ( "\n " ) ;
3212
3219
3213
- attrs. push_str ( & pprust:: attribute_to_string ( & attr) ) ;
3214
- }
3215
3220
if !attrs. is_empty ( ) {
3216
3221
write ! (
3217
3222
w,
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ pub extern "C" fn f() {}
8
8
#[ export_name = "bar" ]
9
9
pub extern "C" fn g ( ) { }
10
10
11
- // @has foo/enum.Foo.html '//*[@class="docblock attributes top-attr"]' '#[repr(i64)]'
12
- // @has foo/enum.Foo.html '//*[@class="docblock attributes top-attr"]' '#[ must_use] '
11
+ // @matches foo/enum.Foo.html '//*[@class="docblock attributes top-attr"]' \
12
+ // '(?m)\A#\[repr\(i64\)\]\n#\[ must_use\]\Z '
13
13
#[ repr( i64 ) ]
14
14
#[ must_use]
15
15
pub enum Foo {
You can’t perform that action at this time.
0 commit comments