@@ -248,7 +248,9 @@ impl<'self> DocFolder for Cache {
248
248
match item. name {
249
249
Some ( ref s) => {
250
250
let parent = match item. inner {
251
- clean:: TyMethodItem ( * ) | clean:: VariantItem ( * ) => {
251
+ clean:: TyMethodItem ( * ) |
252
+ clean:: StructFieldItem ( * ) |
253
+ clean:: VariantItem ( * ) => {
252
254
Some ( ( Some ( * self . parent_stack . last ( ) ) ,
253
255
self . stack . slice_to ( self . stack . len ( ) - 1 ) ) )
254
256
@@ -299,7 +301,7 @@ impl<'self> DocFolder for Cache {
299
301
300
302
// Maintain the parent stack
301
303
let parent_pushed = match item. inner {
302
- clean:: TraitItem ( * ) | clean:: EnumItem ( * ) => {
304
+ clean:: TraitItem ( * ) | clean:: EnumItem ( * ) | clean :: StructItem ( * ) => {
303
305
self . parent_stack . push ( item. id ) ; true
304
306
}
305
307
clean:: ImplItem ( ref i) => {
@@ -510,28 +512,6 @@ impl Context {
510
512
let dst = self . dst . push ( item_path ( & item) ) ;
511
513
let writer = dst. open_writer ( io:: CreateOrTruncate ) ;
512
514
render ( writer. unwrap ( ) , self , & item, true ) ;
513
-
514
- // recurse if necessary
515
- let name = item. name . get_ref ( ) . clone ( ) ;
516
- match item. inner {
517
- clean:: EnumItem ( e) => {
518
- let mut it = e. variants . move_iter ( ) ;
519
- do self. recurse ( name) |this| {
520
- for item in it {
521
- f ( this, item) ;
522
- }
523
- }
524
- }
525
- clean:: StructItem ( s) => {
526
- let mut it = s. fields . move_iter ( ) ;
527
- do self. recurse ( name) |this| {
528
- for item in it {
529
- f ( this, item) ;
530
- }
531
- }
532
- }
533
- _ => { }
534
- }
535
515
}
536
516
537
517
_ => { }
@@ -613,9 +593,6 @@ impl<'self> fmt::Default for Item<'self> {
613
593
clean:: StructItem ( ref s) => item_struct ( fmt. buf , it. item , s) ,
614
594
clean:: EnumItem ( ref e) => item_enum ( fmt. buf , it. item , e) ,
615
595
clean:: TypedefItem ( ref t) => item_typedef ( fmt. buf , it. item , t) ,
616
- clean:: VariantItem ( * ) => item_variant ( fmt. buf , it. cx , it. item ) ,
617
- clean:: StructFieldItem ( * ) => item_struct_field ( fmt. buf , it. cx ,
618
- it. item ) ,
619
596
_ => { }
620
597
}
621
598
}
@@ -862,7 +839,8 @@ fn item_trait(w: &mut io::Writer, it: &clean::Item, t: &clean::Trait) {
862
839
document ( w, it) ;
863
840
864
841
fn meth ( w : & mut io:: Writer , m : & clean:: TraitMethod ) {
865
- write ! ( w, "<h3 id='fn.{}' class='method'><code>" ,
842
+ write ! ( w, "<h3 id='{}.{}' class='method'><code>" ,
843
+ shortty( m. item( ) ) ,
866
844
* m. item( ) . name. get_ref( ) ) ;
867
845
render_method ( w, m. item ( ) , false ) ;
868
846
write ! ( w, "</code></h3>" ) ;
@@ -923,13 +901,15 @@ fn render_method(w: &mut io::Writer, meth: &clean::Item, withlink: bool) {
923
901
g : & clean:: Generics , selfty : & clean:: SelfTy , d : & clean:: FnDecl ,
924
902
withlink : bool ) {
925
903
write ! ( w, "{}fn {withlink, select,
926
- true{<a href='\\ #fn.{name}' class='fnname'>{name}</a>}
904
+ true{<a href='\\ #{ty}.{name}'
905
+ class='fnname'>{name}</a>}
927
906
other{<span class='fnname'>{name}</span>}
928
907
}{generics}{decl}" ,
929
908
match purity {
930
909
ast:: unsafe_fn => "unsafe " ,
931
910
_ => "" ,
932
911
} ,
912
+ ty = shortty( it) ,
933
913
name = it. name. get_ref( ) . as_slice( ) ,
934
914
generics = * g,
935
915
decl = Method ( selfty, d) ,
@@ -1014,7 +994,7 @@ fn render_struct(w: &mut io::Writer, it: &clean::Item,
1014
994
for field in fields. iter ( ) {
1015
995
match field. inner {
1016
996
clean:: StructFieldItem ( ref ty) => {
1017
- write ! ( w, " {}<a name='field .{name}'>{name}</a>: \
997
+ write ! ( w, " {}<a name='structfield .{name}'>{name}</a>: \
1018
998
{},\n {}",
1019
999
VisSpace ( field. visibility) ,
1020
1000
ty. type_,
@@ -1089,7 +1069,7 @@ fn render_impl(w: &mut io::Writer, i: &clean::Impl) {
1089
1069
write ! ( w, "{}</code></h3>" , i. for_) ;
1090
1070
write ! ( w, "<div class='methods'>" ) ;
1091
1071
for meth in i. methods . iter ( ) {
1092
- write ! ( w, "<h4 id='fn .{}' class='method'><code>" ,
1072
+ write ! ( w, "<h4 id='method .{}' class='method'><code>" ,
1093
1073
* meth. name. get_ref( ) ) ;
1094
1074
render_method ( w, meth, false ) ;
1095
1075
write ! ( w, "</code></h4>\n " ) ;
@@ -1196,21 +1176,3 @@ fn build_sidebar(m: &clean::Module) -> HashMap<~str, ~[~str]> {
1196
1176
}
1197
1177
return map;
1198
1178
}
1199
-
1200
- fn item_variant ( w : & mut io:: Writer , cx : & Context , it : & clean:: Item ) {
1201
- write ! ( w, "<DOCTYPE html><html><head>\
1202
- <meta http-equiv='refresh' content='0; \
1203
- url=../enum.{}.html\\ #variant.{}'>\
1204
- </head><body></body></html>",
1205
- * cx. current. last( ) ,
1206
- it. name. get_ref( ) . as_slice( ) ) ;
1207
- }
1208
-
1209
- fn item_struct_field ( w : & mut io:: Writer , cx : & Context , it : & clean:: Item ) {
1210
- write ! ( w, "<DOCTYPE html><html><head>\
1211
- <meta http-equiv='refresh' content='0; \
1212
- url=../struct.{}.html\\ #field.{}'>\
1213
- </head><body></body></html>",
1214
- * cx. current. last( ) ,
1215
- it. name. get_ref( ) . as_slice( ) ) ;
1216
- }
0 commit comments