@@ -34,10 +34,10 @@ use rustc_target::spec::abi::Abi;
34
34
use rustc_typeck:: check:: intrinsic:: intrinsic_operation_unsafety;
35
35
36
36
use crate :: clean:: cfg:: Cfg ;
37
+ use crate :: clean:: clean_visibility;
37
38
use crate :: clean:: external_path;
38
39
use crate :: clean:: inline:: { self , print_inlined_const} ;
39
40
use crate :: clean:: utils:: { is_literal_expr, print_const_expr, print_evaluated_const} ;
40
- use crate :: clean:: { clean_visibility, Clean } ;
41
41
use crate :: core:: DocContext ;
42
42
use crate :: formats:: cache:: Cache ;
43
43
use crate :: formats:: item_type:: ItemType ;
@@ -477,7 +477,7 @@ impl Item {
477
477
def_id,
478
478
name,
479
479
kind,
480
- Box :: new ( ast_attrs . clean ( cx ) ) ,
480
+ Box :: new ( Attributes :: from_ast ( ast_attrs ) ) ,
481
481
cx,
482
482
ast_attrs. cfg ( cx. tcx , & cx. cache . hidden_cfg ) ,
483
483
)
@@ -1177,14 +1177,16 @@ impl Attributes {
1177
1177
false
1178
1178
}
1179
1179
1180
- pub ( crate ) fn from_ast (
1180
+ pub ( crate ) fn from_ast ( attrs : & [ ast:: Attribute ] ) -> Attributes {
1181
+ Attributes :: from_ast_iter ( attrs. iter ( ) . map ( |attr| ( attr, None ) ) , false )
1182
+ }
1183
+
1184
+ pub ( crate ) fn from_ast_with_additional (
1181
1185
attrs : & [ ast:: Attribute ] ,
1182
- additional_attrs : Option < ( & [ ast:: Attribute ] , DefId ) > ,
1186
+ ( additional_attrs, def_id ) : ( & [ ast:: Attribute ] , DefId ) ,
1183
1187
) -> Attributes {
1184
1188
// Additional documentation should be shown before the original documentation.
1185
- let attrs1 = additional_attrs
1186
- . into_iter ( )
1187
- . flat_map ( |( attrs, def_id) | attrs. iter ( ) . map ( move |attr| ( attr, Some ( def_id) ) ) ) ;
1189
+ let attrs1 = additional_attrs. iter ( ) . map ( |attr| ( attr, Some ( def_id) ) ) ;
1188
1190
let attrs2 = attrs. iter ( ) . map ( |attr| ( attr, None ) ) ;
1189
1191
Attributes :: from_ast_iter ( attrs1. chain ( attrs2) , false )
1190
1192
}
0 commit comments