@@ -920,9 +920,10 @@ impl DocFolder for Cache {
920
920
let path = match self . paths . get ( & did) {
921
921
Some ( & ( _, ItemType :: Trait ) ) =>
922
922
Some ( & self . stack [ ..self . stack . len ( ) - 1 ] ) ,
923
- // The current stack not necessarily has correlation for
924
- // where the type was defined. On the other hand,
925
- // `paths` always has the right information if present.
923
+ // The current stack not necessarily has correlation
924
+ // for where the type was defined. On the other
925
+ // hand, `paths` always has the right
926
+ // information if present.
926
927
Some ( & ( ref fqp, ItemType :: Struct ) ) |
927
928
Some ( & ( ref fqp, ItemType :: Enum ) ) =>
928
929
Some ( & fqp[ ..fqp. len ( ) - 1 ] ) ,
@@ -1861,6 +1862,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
1861
1862
try!( write ! ( w, "</div>" ) ) ;
1862
1863
}
1863
1864
1865
+ // If there are methods directly on this trait object, render them here.
1866
+ try!( render_methods ( w, it) ) ;
1867
+
1864
1868
let cache = cache ( ) ;
1865
1869
try!( write ! ( w, "
1866
1870
<h2 id='implementors'>Implementors</h2>
@@ -2179,37 +2183,36 @@ enum MethodLink {
2179
2183
}
2180
2184
2181
2185
fn render_methods ( w : & mut fmt:: Formatter , it : & clean:: Item ) -> fmt:: Result {
2182
- match cache ( ) . impls . get ( & it. def_id ) {
2183
- Some ( v) => {
2184
- let ( non_trait , traits ) : ( Vec < _ > , _ ) = v . iter ( ) . cloned ( )
2185
- . partition ( |i| i . impl_ . trait_ . is_none ( ) ) ;
2186
- if non_trait . len ( ) > 0 {
2187
- try! ( write ! ( w , "<h2 id='methods'>Methods</h2>" ) ) ;
2188
- for i in & non_trait {
2189
- try!( render_impl ( w, i , MethodLink :: Anchor ) ) ;
2190
- }
2191
- }
2192
- if traits . len ( ) > 0 {
2193
- try! ( write ! ( w , "<h2 id='implementations'>Trait \
2194
- Implementations</h2>" ) ) ;
2195
- let ( derived , manual ) : ( Vec < _ > , _ ) = traits . into_iter ( )
2196
- . partition ( |i| i . impl_ . derived ) ;
2197
- for i in & manual {
2198
- let did = i . trait_did ( ) . unwrap ( ) ;
2199
- try! ( render_impl ( w , i , MethodLink :: GotoSource ( did ) ) ) ;
2200
- }
2201
- if derived . len ( ) > 0 {
2202
- try! ( write ! ( w , "<h3 id='derived_implementations'> \
2203
- Derived Implementations \
2204
- </h3>" ) ) ;
2205
- for i in & derived {
2206
- let did = i . trait_did ( ) . unwrap ( ) ;
2207
- try! ( render_impl ( w , i , MethodLink :: GotoSource ( did ) ) ) ;
2208
- }
2209
- }
2186
+ let v = match cache ( ) . impls . get ( & it. def_id ) {
2187
+ Some ( v) => v . clone ( ) ,
2188
+ None => return Ok ( ( ) ) ,
2189
+ } ;
2190
+ let ( non_trait , traits ) : ( Vec < _ > , _ ) = v . into_iter ( )
2191
+ . partition ( |i| i . impl_ . trait_ . is_none ( ) ) ;
2192
+ if non_trait . len ( ) > 0 {
2193
+ try!( write ! ( w, "<h2 id='methods'>Methods</h2>" ) ) ;
2194
+ for i in & non_trait {
2195
+ try! ( render_impl ( w , i , MethodLink :: Anchor ) ) ;
2196
+ }
2197
+ }
2198
+ if traits . len ( ) > 0 {
2199
+ try! ( write ! ( w , "<h2 id='implementations'>Trait \
2200
+ Implementations</h2>" ) ) ;
2201
+ let ( derived , manual ) : ( Vec < _ > , _ ) = traits . into_iter ( )
2202
+ . partition ( |i| i . impl_ . derived ) ;
2203
+ for i in & manual {
2204
+ let did = i . trait_did ( ) . unwrap ( ) ;
2205
+ try! ( render_impl ( w , i , MethodLink :: GotoSource ( did ) ) ) ;
2206
+ }
2207
+ if derived . len ( ) > 0 {
2208
+ try! ( write ! ( w , "<h3 id='derived_implementations'> \
2209
+ Derived Implementations \
2210
+ </h3>" ) ) ;
2211
+ for i in & derived {
2212
+ let did = i . trait_did ( ) . unwrap ( ) ;
2213
+ try! ( render_impl ( w , i , MethodLink :: GotoSource ( did ) ) ) ;
2210
2214
}
2211
2215
}
2212
- None => { }
2213
2216
}
2214
2217
Ok ( ( ) )
2215
2218
}
0 commit comments