diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-06-01 11:29:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-01 11:29:43 +0200 |
| commit | 085691b137cd255b32c66a3aa843783fa7ead726 (patch) | |
| tree | 37504781666f0002d416defa4edd5e6c7489fa1f /src/test/rustdoc/toggle-method.rs | |
| parent | 2ffe87a434c22616a071ffdd6e3ddc7c8735425e (diff) | |
| parent | 10bafe1975e53769180701508e2b8cd3a3b34a0e (diff) | |
| download | rust-085691b137cd255b32c66a3aa843783fa7ead726.tar.gz rust-085691b137cd255b32c66a3aa843783fa7ead726.zip | |
Rollup merge of #85622 - jsha:untoggle-undocumented, r=GuillaumeGomez
Remove toggle for "undocumented items." Per discussion in #84326. For trait implementations, this was misleading: the items actually do have documentation (but it comes from the trait definition). For both trait implementations and trait implementors, this was redundant: in both of those cases, the items are default-hidden by different toggle at the level above. Update tests: Remove XPath selectors that over-specified on details tag, in cases that weren't testing toggles. Add an explicit test for toggles on methods. Rename item-hide-threshold to toggle-item-contents for consistency. Demo: https://hoffman-andrews.com/rust/untoggle-undocumented/std/string/struct.String.html https://hoffman-andrews.com/rust/untoggle-undocumented/std/io/trait.Read.html
Diffstat (limited to 'src/test/rustdoc/toggle-method.rs')
| -rw-r--r-- | src/test/rustdoc/toggle-method.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/rustdoc/toggle-method.rs b/src/test/rustdoc/toggle-method.rs new file mode 100644 index 00000000000..f7f6086a4cb --- /dev/null +++ b/src/test/rustdoc/toggle-method.rs @@ -0,0 +1,18 @@ +#![crate_name = "foo"] + +// Struct methods with documentation should be wrapped in a <details> toggle with an appropriate +// summary. Struct methods with no documentation should not be wrapped. +// +// @has foo/struct.Foo.html +// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//code' 'is_documented()' +// @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented is documented' +// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//code' 'not_documented()' +pub struct Foo { +} + +impl Foo { + pub fn not_documented() {} + + /// is_documented is documented + pub fn is_documented() {} +} |
