Rollup merge of #33679 - Manishearth:rustdoc-readmore-impls, r=alexcrichton
rustdoc: Add doc snippets for trait impls, with a read more link The read more link only appears if the documentation is more than one line long.  It currently does not appear on non-defaulted methods, since you can document them directly. I could make it so that default documentation gets forwarded if regular docs don't exist. Fixes #33672 r? @alexcrichton cc @steveklabnik
This commit is contained in:
commit
3f4d915147
2 changed files with 62 additions and 18 deletions
|
|
@ -21,13 +21,24 @@ pub trait T {
|
|||
fn b_method(&self) -> usize {
|
||||
self.a_method()
|
||||
}
|
||||
|
||||
/// Docs associated with the trait c_method definition.
|
||||
///
|
||||
/// There is another line
|
||||
fn c_method(&self) -> usize {
|
||||
self.a_method()
|
||||
}
|
||||
}
|
||||
|
||||
// @has manual_impl/struct.S1.html '//*[@class="trait"]' 'T'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the S1 trait implementation.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the S1 trait a_method implementation.'
|
||||
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
|
||||
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
|
||||
// @!has - '//*[@class="docblock"]' 'There is another line'
|
||||
// @has - '//*[@class="docblock"]' 'Read more'
|
||||
pub struct S1(usize);
|
||||
|
||||
/// Docs associated with the S1 trait implementation.
|
||||
|
|
@ -41,9 +52,11 @@ impl T for S1 {
|
|||
// @has manual_impl/struct.S2.html '//*[@class="trait"]' 'T'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait implementation.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait a_method implementation.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait b_method implementation.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait c_method implementation.'
|
||||
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
|
||||
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
|
||||
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
|
||||
// @!has - '//*[@class="docblock"]' 'Read more'
|
||||
pub struct S2(usize);
|
||||
|
||||
/// Docs associated with the S2 trait implementation.
|
||||
|
|
@ -53,8 +66,8 @@ impl T for S2 {
|
|||
self.0
|
||||
}
|
||||
|
||||
/// Docs associated with the S2 trait b_method implementation.
|
||||
fn b_method(&self) -> usize {
|
||||
/// Docs associated with the S2 trait c_method implementation.
|
||||
fn c_method(&self) -> usize {
|
||||
5
|
||||
}
|
||||
}
|
||||
|
|
@ -62,7 +75,7 @@ impl T for S2 {
|
|||
// @has manual_impl/struct.S3.html '//*[@class="trait"]' 'T'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the S3 trait implementation.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the S3 trait b_method implementation.'
|
||||
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
|
||||
// @has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
|
||||
pub struct S3(usize);
|
||||
|
||||
/// Docs associated with the S3 trait implementation.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue