Rollup merge of #103793 - notriddle:notriddle/rustdoc-toggle-in-impl-items, r=GuillaumeGomez
rustdoc: add margins to all impl-item toggles, not just methods Fixes #103782 ## Before  ## After 
This commit is contained in:
commit
2c7f1374ec
3 changed files with 42 additions and 6 deletions
|
@ -1968,24 +1968,26 @@ in storage.js
|
|||
}
|
||||
}
|
||||
|
||||
.method-toggle > summary,
|
||||
.implementors-toggle > summary,
|
||||
.impl,
|
||||
#implementors-list > .docblock,
|
||||
.impl-items > section,
|
||||
.methods > section
|
||||
.impl-items > .rustdoc-toggle > summary,
|
||||
.methods > section,
|
||||
.methods > .rustdoc-toggle > summary
|
||||
{
|
||||
margin-bottom: 0.75em;
|
||||
}
|
||||
|
||||
.method-toggle[open]:not(:last-child),
|
||||
.impl-items > .rustdoc-toggle[open]:not(:last-child),
|
||||
.methods > .rustdoc-toggle[open]:not(:last-child),
|
||||
.implementors-toggle[open]:not(:last-child) {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
#trait-implementations-list .method-toggle:not(:last-child),
|
||||
#synthetic-implementations-list .method-toggle:not(:last-child),
|
||||
#blanket-implementations-list .method-toggle:not(:last-child) {
|
||||
#trait-implementations-list .impl-items > .rustdoc-toggle:not(:last-child),
|
||||
#synthetic-implementations-list .impl-items > .rustdoc-toggle:not(:last-child),
|
||||
#blanket-implementations-list .impl-items > .rustdoc-toggle:not(:last-child) {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
|
|
17
src/test/rustdoc-gui/method-margins.goml
Normal file
17
src/test/rustdoc-gui/method-margins.goml
Normal file
|
@ -0,0 +1,17 @@
|
|||
goto: "file://" + |DOC_PATH| + "/test_docs/trait_members/struct.HasTrait.html#impl-TraitMembers-for-HasTrait"
|
||||
|
||||
assert-count: ("#trait-implementations-list > .rustdoc-toggle", 1)
|
||||
|
||||
compare-elements-css: (
|
||||
// compare margin on type with margin on method
|
||||
"#trait-implementations-list .impl-items > .rustdoc-toggle:nth-child(1) > summary",
|
||||
"#trait-implementations-list .impl-items > .rustdoc-toggle:nth-child(2) > summary",
|
||||
["margin"]
|
||||
)
|
||||
|
||||
compare-elements-css: (
|
||||
// compare margin on type with margin on method
|
||||
"#trait-implementations-list .impl-items > .rustdoc-toggle:nth-child(1)",
|
||||
"#trait-implementations-list .impl-items > .rustdoc-toggle:nth-child(2)",
|
||||
["margin"]
|
||||
)
|
|
@ -416,3 +416,20 @@ pub trait TraitWithoutGenerics {
|
|||
|
||||
fn foo();
|
||||
}
|
||||
|
||||
pub mod trait_members {
|
||||
pub trait TraitMembers {
|
||||
/// Some type
|
||||
type Type;
|
||||
/// Some function
|
||||
fn function();
|
||||
/// Some other function
|
||||
fn function2();
|
||||
}
|
||||
pub struct HasTrait;
|
||||
impl TraitMembers for HasTrait {
|
||||
type Type = u8;
|
||||
fn function() {}
|
||||
fn function2() {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue