@@ -347,18 +347,18 @@ impl Clean<Item> for doctree::Module {
347
347
}
348
348
}
349
349
let items: Vec < Vec < Item > > = vec ! (
350
- self . structs. clean( ) . move_iter ( ) . collect ( ) ,
351
- self . enums. clean( ) . move_iter ( ) . collect ( ) ,
352
- self . fns. clean( ) . move_iter ( ) . collect ( ) ,
350
+ self . structs. clean( ) ,
351
+ self . enums. clean( ) ,
352
+ self . fns. clean( ) ,
353
353
foreigns,
354
- self . mods. clean( ) . move_iter ( ) . collect ( ) ,
355
- self . typedefs. clean( ) . move_iter ( ) . collect ( ) ,
356
- self . statics. clean( ) . move_iter ( ) . collect ( ) ,
357
- self . traits. clean( ) . move_iter ( ) . collect ( ) ,
358
- self . impls. clean( ) . move_iter ( ) . collect ( ) ,
354
+ self . mods. clean( ) ,
355
+ self . typedefs. clean( ) ,
356
+ self . statics. clean( ) ,
357
+ self . traits. clean( ) ,
358
+ self . impls. clean( ) ,
359
359
self . view_items. clean( ) . move_iter( )
360
360
. flat_map( |s| s. move_iter( ) ) . collect( ) ,
361
- self . macros. clean( ) . move_iter ( ) . collect ( )
361
+ self . macros. clean( ) ,
362
362
) ;
363
363
364
364
// determine if we should display the inner contents or
@@ -406,7 +406,7 @@ impl Clean<Attribute> for ast::MetaItem {
406
406
match self . node {
407
407
ast:: MetaWord ( ref s) => Word ( s. get ( ) . to_string ( ) ) ,
408
408
ast:: MetaList ( ref s, ref l) => {
409
- List ( s. get ( ) . to_string ( ) , l. clean ( ) . move_iter ( ) . collect ( ) )
409
+ List ( s. get ( ) . to_string ( ) , l. clean ( ) )
410
410
}
411
411
ast:: MetaNameValue ( ref s, ref v) => {
412
412
NameValue ( s. get ( ) . to_string ( ) , lit_to_string ( v) )
@@ -460,7 +460,7 @@ impl Clean<TyParam> for ast::TyParam {
460
460
TyParam {
461
461
name : self . ident . clean ( ) ,
462
462
did : ast:: DefId { krate : ast:: LOCAL_CRATE , node : self . id } ,
463
- bounds : self . bounds . clean ( ) . move_iter ( ) . collect ( ) ,
463
+ bounds : self . bounds . clean ( ) ,
464
464
default : self . default . clean ( )
465
465
}
466
466
}
@@ -688,7 +688,7 @@ impl Clean<Item> for ast::Method {
688
688
} ;
689
689
Item {
690
690
name : Some ( self . pe_ident ( ) . clean ( ) ) ,
691
- attrs : self . attrs . clean ( ) . move_iter ( ) . collect ( ) ,
691
+ attrs : self . attrs . clean ( ) ,
692
692
source : self . span . clean ( ) ,
693
693
def_id : ast_util:: local_def ( self . id ) ,
694
694
visibility : self . pe_vis ( ) . clean ( ) ,
@@ -727,7 +727,7 @@ impl Clean<Item> for ast::TypeMethod {
727
727
} ;
728
728
Item {
729
729
name : Some ( self . ident . clean ( ) ) ,
730
- attrs : self . attrs . clean ( ) . move_iter ( ) . collect ( ) ,
730
+ attrs : self . attrs . clean ( ) ,
731
731
source : self . span . clean ( ) ,
732
732
def_id : ast_util:: local_def ( self . id ) ,
733
733
visibility : None ,
@@ -805,7 +805,7 @@ impl Clean<ClosureDecl> for ast::ClosureTy {
805
805
onceness : self . onceness ,
806
806
fn_style : self . fn_style ,
807
807
bounds : match self . bounds {
808
- Some ( ref x) => x. clean ( ) . move_iter ( ) . collect ( ) ,
808
+ Some ( ref x) => x. clean ( ) ,
809
809
None => Vec :: new ( )
810
810
} ,
811
811
}
@@ -1178,7 +1178,7 @@ impl Clean<Type> for ast::Ty {
1178
1178
TyTup ( ref tys) => Tuple ( tys. iter ( ) . map ( |x| x. clean ( ) ) . collect ( ) ) ,
1179
1179
TyPath ( ref p, ref tpbs, id) => {
1180
1180
resolve_type ( p. clean ( ) ,
1181
- tpbs. clean ( ) . map ( |x| x. move_iter ( ) . collect ( ) ) ,
1181
+ tpbs. clean ( ) . map ( |x| x) ,
1182
1182
id)
1183
1183
}
1184
1184
TyClosure ( ref c, region) => Closure ( box c. clean ( ) , region. clean ( ) ) ,
@@ -1307,7 +1307,7 @@ impl Clean<Item> for ast::StructField {
1307
1307
} ;
1308
1308
Item {
1309
1309
name : name. clean ( ) ,
1310
- attrs : self . node . attrs . clean ( ) . move_iter ( ) . collect ( ) ,
1310
+ attrs : self . node . attrs . clean ( ) ,
1311
1311
source : self . span . clean ( ) ,
1312
1312
visibility : Some ( vis) ,
1313
1313
stability : get_stability ( ast_util:: local_def ( self . node . id ) ) ,
@@ -1320,16 +1320,26 @@ impl Clean<Item> for ast::StructField {
1320
1320
impl Clean < Item > for ty:: field_ty {
1321
1321
fn clean ( & self ) -> Item {
1322
1322
use syntax:: parse:: token:: special_idents:: unnamed_field;
1323
+ use rustc:: metadata:: csearch;
1324
+
1325
+ let cx = get_cx ( ) ;
1326
+ let attrs;
1327
+
1328
+ let attr_map = csearch:: get_struct_field_attrs ( & cx. tcx ( ) . sess . cstore , self . id ) ;
1329
+
1323
1330
let name = if self . name == unnamed_field. name {
1331
+ attrs = None ;
1324
1332
None
1325
1333
} else {
1334
+ attrs = Some ( attr_map. find ( & self . id . node ) . unwrap ( ) ) ;
1326
1335
Some ( self . name )
1327
1336
} ;
1328
- let cx = get_cx ( ) ;
1337
+
1329
1338
let ty = ty:: lookup_item_type ( cx. tcx ( ) , self . id ) ;
1339
+
1330
1340
Item {
1331
1341
name : name. clean ( ) ,
1332
- attrs : inline :: load_attrs ( cx . tcx ( ) , self . id ) ,
1342
+ attrs : attrs . unwrap_or ( & Vec :: new ( ) ) . clean ( ) ,
1333
1343
source : Span :: empty ( ) ,
1334
1344
visibility : Some ( self . vis ) ,
1335
1345
stability : get_stability ( self . id ) ,
@@ -1388,7 +1398,7 @@ impl Clean<VariantStruct> for syntax::ast::StructDef {
1388
1398
fn clean ( & self ) -> VariantStruct {
1389
1399
VariantStruct {
1390
1400
struct_type : doctree:: struct_type_from_def ( self ) ,
1391
- fields : self . fields . clean ( ) . move_iter ( ) . collect ( ) ,
1401
+ fields : self . fields . clean ( ) ,
1392
1402
fields_stripped : false ,
1393
1403
}
1394
1404
}
@@ -1556,7 +1566,7 @@ impl Clean<Path> for ast::Path {
1556
1566
fn clean ( & self ) -> Path {
1557
1567
Path {
1558
1568
global : self . global ,
1559
- segments : self . segments . clean ( ) . move_iter ( ) . collect ( ) ,
1569
+ segments : self . segments . clean ( ) ,
1560
1570
}
1561
1571
}
1562
1572
}
@@ -1572,8 +1582,8 @@ impl Clean<PathSegment> for ast::PathSegment {
1572
1582
fn clean ( & self ) -> PathSegment {
1573
1583
PathSegment {
1574
1584
name : self . identifier . clean ( ) ,
1575
- lifetimes : self . lifetimes . clean ( ) . move_iter ( ) . collect ( ) ,
1576
- types : self . types . clean ( ) . move_iter ( ) . collect ( )
1585
+ lifetimes : self . lifetimes . clean ( ) ,
1586
+ types : self . types . clean ( ) ,
1577
1587
}
1578
1588
}
1579
1589
}
@@ -1640,7 +1650,7 @@ impl Clean<BareFunctionDecl> for ast::BareFnTy {
1640
1650
BareFunctionDecl {
1641
1651
fn_style : self . fn_style ,
1642
1652
generics : Generics {
1643
- lifetimes : self . lifetimes . clean ( ) . move_iter ( ) . collect ( ) ,
1653
+ lifetimes : self . lifetimes . clean ( ) ,
1644
1654
type_params : Vec :: new ( ) ,
1645
1655
} ,
1646
1656
decl : self . decl . clean ( ) ,
@@ -1745,7 +1755,7 @@ impl Clean<Vec<Item>> for ast::ViewItem {
1745
1755
let convert = |node : & ast:: ViewItem_ | {
1746
1756
Item {
1747
1757
name : None ,
1748
- attrs : self . attrs . clean ( ) . move_iter ( ) . collect ( ) ,
1758
+ attrs : self . attrs . clean ( ) ,
1749
1759
source : self . span . clean ( ) ,
1750
1760
def_id : ast_util:: local_def ( 0 ) ,
1751
1761
visibility : self . vis . clean ( ) ,
@@ -1840,7 +1850,7 @@ impl Clean<ViewPath> for ast::ViewPath {
1840
1850
GlobImport ( resolve_use_source ( p. clean ( ) , id) ) ,
1841
1851
ast:: ViewPathList ( ref p, ref pl, id) => {
1842
1852
ImportList ( resolve_use_source ( p. clean ( ) , id) ,
1843
- pl. clean ( ) . move_iter ( ) . collect ( ) )
1853
+ pl. clean ( ) )
1844
1854
}
1845
1855
}
1846
1856
}
@@ -1893,7 +1903,7 @@ impl Clean<Item> for ast::ForeignItem {
1893
1903
} ;
1894
1904
Item {
1895
1905
name : Some ( self . ident . clean ( ) ) ,
1896
- attrs : self . attrs . clean ( ) . move_iter ( ) . collect ( ) ,
1906
+ attrs : self . attrs . clean ( ) ,
1897
1907
source : self . span . clean ( ) ,
1898
1908
def_id : ast_util:: local_def ( self . id ) ,
1899
1909
visibility : self . vis . clean ( ) ,
0 commit comments