File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ use std::str;
4242use std:: string:: ToString ;
4343use std:: sync:: Arc ;
4444
45+ use itertools:: Itertools ;
4546use rustc_ast_pretty:: pprust;
4647use rustc_data_structures:: flock;
4748use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
@@ -3170,15 +3171,19 @@ const ALLOWED_ATTRIBUTES: &[Symbol] = &[
31703171// bar: usize,
31713172// }
31723173fn render_attributes ( w : & mut Buffer , it : & clean:: Item , top : bool ) {
3173- let mut attrs = String :: new ( ) ;
3174-
3175- for attr in & it. attrs . other_attrs {
3176- if !ALLOWED_ATTRIBUTES . contains ( & attr. name_or_empty ( ) ) {
3177- continue ;
3178- }
3174+ let attrs = it
3175+ . attrs
3176+ . other_attrs
3177+ . iter ( )
3178+ . filter_map ( |attr| {
3179+ if ALLOWED_ATTRIBUTES . contains ( & attr. name_or_empty ( ) ) {
3180+ Some ( pprust:: attribute_to_string ( & attr) )
3181+ } else {
3182+ None
3183+ }
3184+ } )
3185+ . join ( "\n " ) ;
31793186
3180- attrs. push_str ( & pprust:: attribute_to_string ( & attr) ) ;
3181- }
31823187 if !attrs. is_empty ( ) {
31833188 write ! (
31843189 w,
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ pub extern "C" fn f() {}
88#[ export_name = "bar" ]
99pub extern "C" fn g ( ) { }
1010
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 '
1313#[ repr( i64 ) ]
1414#[ must_use]
1515pub enum Foo {
You can’t perform that action at this time.
0 commit comments