forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove toggle for "undocumented items."
Per discussion in rust-lang#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.
- Loading branch information
Showing
8 changed files
with
64 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
#![crate_name = "foo"] | ||
|
||
// Trait methods with documentation should be wrapped in a <details> toggle with an appropriate | ||
// summary. Trait methods with no documentation should not be wrapped. | ||
// | ||
// @has foo/trait.Foo.html | ||
// @!has - '//details[@class="rustdoc-toggle"]//code' 'bar' | ||
// @has - '//code' 'bar' | ||
// @has - '//details[@class="rustdoc-toggle"]//code' 'foo' | ||
// @has - '//details[@class="rustdoc-toggle"]//summary//code' 'is_documented()' | ||
// @!has - '//details[@class="rustdoc-toggle"]//summary//code' 'not_documented()' | ||
// @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented is documented' | ||
// @has - '//details[@class="rustdoc-toggle"]//summary//code' 'is_documented_optional()' | ||
// @!has - '//details[@class="rustdoc-toggle"]//summary//code' 'not_documented_optional()' | ||
// @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented_optional is documented' | ||
pub trait Foo { | ||
fn bar() -> (); | ||
/// hello | ||
fn foo(); | ||
fn not_documented(); | ||
|
||
/// is_documented is documented | ||
fn is_documented(); | ||
|
||
fn not_documented_optional() {} | ||
|
||
/// is_documented_optional is documented | ||
fn is_documented_optional() {} | ||
} |