@@ -34,10 +34,10 @@ use rustc_target::spec::abi::Abi;
3434use rustc_typeck:: check:: intrinsic:: intrinsic_operation_unsafety;
3535
3636use crate :: clean:: cfg:: Cfg ;
37+ use crate :: clean:: clean_visibility;
3738use crate :: clean:: external_path;
3839use crate :: clean:: inline:: { self , print_inlined_const} ;
3940use crate :: clean:: utils:: { is_literal_expr, print_const_expr, print_evaluated_const} ;
40- use crate :: clean:: { clean_visibility, Clean } ;
4141use crate :: core:: DocContext ;
4242use crate :: formats:: cache:: Cache ;
4343use crate :: formats:: item_type:: ItemType ;
@@ -477,7 +477,7 @@ impl Item {
477477 def_id,
478478 name,
479479 kind,
480- Box :: new ( ast_attrs . clean ( cx ) ) ,
480+ Box :: new ( Attributes :: from_ast ( ast_attrs ) ) ,
481481 cx,
482482 ast_attrs. cfg ( cx. tcx , & cx. cache . hidden_cfg ) ,
483483 )
@@ -1177,14 +1177,16 @@ impl Attributes {
11771177 false
11781178 }
11791179
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 (
11811185 attrs : & [ ast:: Attribute ] ,
1182- additional_attrs : Option < ( & [ ast:: Attribute ] , DefId ) > ,
1186+ ( additional_attrs, def_id ) : ( & [ ast:: Attribute ] , DefId ) ,
11831187 ) -> Attributes {
11841188 // 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) ) ) ;
11881190 let attrs2 = attrs. iter ( ) . map ( |attr| ( attr, None ) ) ;
11891191 Attributes :: from_ast_iter ( attrs1. chain ( attrs2) , false )
11901192 }
0 commit comments