diff options
| author | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-12-10 11:35:26 -0800 |
|---|---|---|
| committer | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-12-10 22:25:43 -0800 |
| commit | 3f517fb1ae1af9f10e0e7492f725b729202499cf (patch) | |
| tree | eccebae4ffee1fe81cefaa27a640876bdd486750 | |
| parent | c8e0f97ad2e8efc71a7099ae1f67be8e7dcb5f6b (diff) | |
| download | rust-3f517fb1ae1af9f10e0e7492f725b729202499cf.tar.gz rust-3f517fb1ae1af9f10e0e7492f725b729202499cf.zip | |
Split CSS classes for "typedef" vs "associatedtype".
| -rw-r--r-- | src/librustdoc/html/format.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/themes/ayu.css | 12 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/themes/dark.css | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/themes/light.css | 10 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/font-weight.goml | 4 | ||||
| -rw-r--r-- | src/test/rustdoc/assoc-item-cast.rs | 3 | ||||
| -rw-r--r-- | src/test/rustdoc/trait-impl-items-links-and-anchors.rs | 7 |
8 files changed, 31 insertions, 17 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 4f204913204..ad5d20550ee 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -944,7 +944,7 @@ fn fmt_type<'cx>( Ok((ref url, _, ref path)) if !f.alternate() => { write!( f, - "<a class=\"type\" href=\"{url}#{shortty}.{name}\" \ + "<a class=\"associatedtype\" href=\"{url}#{shortty}.{name}\" \ title=\"type {path}::{name}\">{name}</a>", url = url, shortty = ItemType::AssocType, diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 24baca285c6..99cc9cecb1e 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -797,7 +797,7 @@ fn assoc_type( ) { write!( w, - "{}type <a href=\"{}\" class=\"type\">{}</a>", + "{}type <a href=\"{}\" class=\"associatedtype\">{}</a>", extra, naive_assoc_href(it, link, cx), it.name.as_ref().unwrap() diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index bbf9b5ba6ff..9b98fd7582d 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -190,6 +190,12 @@ pre, .rustdoc.source .example-wrap { .content span.type, .content a.type { color: #39AFD7; } +.content span.type, +.content a.type, +.block a.current.type { color: #39AFD7; } +.content span.associatedtype, +.content a.associatedtype, +.block a.current.associatedtype { color: #39AFD7; } .content span.fn, .content a.fn, .content span.method, .content a.method, .content span.tymethod, .content a.tymethod, .content .fnname { @@ -454,11 +460,12 @@ above the `@media (max-width: 700px)` rules due to a bug in the css checker */ .block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro {} .content span.struct,.content a.struct,.block a.current.struct {} #titles>button:hover,#titles>button.selected {} -.content span.type,.content a.type,.block a.current.type {} +.content span.typedef,.content a.typedef,.block a.current.typedef {} .content span.union,.content a.union,.block a.current.union {} pre.rust .lifetime {} .stab.unstable {} -h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod) {} +h2, +h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {} .content span.enum,.content a.enum,.block a.current.enum {} .content span.constant,.content a.constant,.block a.current.constant,.content span.static, .content a.static, .block a.current.static {} @@ -495,6 +502,7 @@ a.result-fn:focus, a.result-method:focus, a.result-tymethod:focus {} a.result-type:focus {} +a.result-associatedtype:focus {} a.result-foreigntype:focus {} a.result-attr:focus, a.result-derive:focus, diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index f3aca6746c9..968a6218d98 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -126,7 +126,8 @@ a.result-union:focus { background-color: #194e9f; } a.result-fn:focus, a.result-method:focus, a.result-tymethod:focus { background-color: #4950ed; } -a.result-type:focus { background-color: #884719; } +a.result-type:focus { background-color: #194e9f; } +a.result-associatedtype:focus { background-color: #884719; } a.result-foreigntype:focus { background-color: #194e9f; } a.result-attr:focus, a.result-derive:focus, @@ -140,7 +141,10 @@ a.result-keyword:focus { background-color: #884719; } .content span.enum, .content a.enum, .block a.current.enum { color: #2dbfb8; } .content span.struct, .content a.struct, .block a.current.struct { color: #2dbfb8; } -.content span.type, .content a.type, .block a.current.type { color: #D2991D; } +.content span.type, .content a.type, .block a.current.type { color: #2dbfb8; } +.content span.associatedtype, +.content a.associatedtype, +.block a.current.associatedtype { color: #D2991D; } .content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #2dbfb8; } .content span.attr, .content a.attr, .block a.current.attr, .content span.derive, .content a.derive, .block a.current.derive, diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 4bf323d3396..14b8461116f 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -126,7 +126,8 @@ a.result-union:focus { background-color: #e7b1a0; } a.result-fn:focus, a.result-method:focus, a.result-tymethod:focus { background-color: #c6afb3; } -a.result-type:focus { background-color: #afc6e4; } +a.result-type:focus { background-color: #e7b1a0; } +a.result-associatedtype:focus { background-color: #afc6e4; } a.result-foreigntype:focus { background-color: #e7b1a0; } a.result-attr:focus, a.result-derive:focus, @@ -140,8 +141,11 @@ a.result-keyword:focus { background-color: #afc6e4; } .content span.enum, .content a.enum, .block a.current.enum { color: #AD378A; } .content span.struct, .content a.struct, .block a.current.struct { color: #AD378A; } -.content span.type, .content a.type, .block a.current.type { color: #3873AD; } -.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #AD378A; } +.content span.type, .content a.type, .block a.current.type { color: #AD378A; } +.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #3873AD; } +.content span.associatedtype, +.content a.associatedtype, +.block a.current.associatedtype { color: #3873AD; } .content span.attr, .content a.attr, .block a.current.attr, .content span.derive, .content a.derive, .block a.current.derive, .content span.macro, .content a.macro, .block a.current.macro { color: #068000; } diff --git a/src/test/rustdoc-gui/font-weight.goml b/src/test/rustdoc-gui/font-weight.goml index 0459fd4b9c3..a22167d8a1d 100644 --- a/src/test/rustdoc-gui/font-weight.goml +++ b/src/test/rustdoc-gui/font-weight.goml @@ -28,8 +28,8 @@ goto: file://|DOC_PATH|/lib2/trait.Trait.html assert-count: ("//*[@class='docblock item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", 1) assert-css: ("//*[@class='docblock item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", {"font-weight": "400"}) -assert-count: (".methods .type", 1) -assert-css: (".methods .type", {"font-weight": "600"}) +assert-count: (".methods .associatedtype", 1) +assert-css: (".methods .associatedtype", {"font-weight": "600"}) assert-count: (".methods .constant", 1) assert-css: (".methods .constant", {"font-weight": "600"}) assert-css: (".methods .method", {"font-weight": "600"}) diff --git a/src/test/rustdoc/assoc-item-cast.rs b/src/test/rustdoc/assoc-item-cast.rs index 273fc62aa17..a409d64131a 100644 --- a/src/test/rustdoc/assoc-item-cast.rs +++ b/src/test/rustdoc/assoc-item-cast.rs @@ -1,6 +1,5 @@ #![crate_name = "foo"] - pub trait Expression { type SqlType; } @@ -11,5 +10,5 @@ pub trait AsExpression<T> { } // @has foo/type.AsExprOf.html -// @has - '//*[@class="rust typedef"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;' +// @has - '//pre[@class="rust typedef"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;' pub type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression; diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs index 4d25835bf08..db9adb4838e 100644 --- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs +++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs @@ -6,9 +6,8 @@ pub trait MyTrait { fn defaulted_override(&self) {} } - impl MyTrait for String { - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="type"]/@href' #associatedtype.Assoc + // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="anchor"]/@href' #associatedtype.Assoc-1 type Assoc = (); // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-1"]//a[@class="constant"]/@href' #associatedconstant.VALUE @@ -23,7 +22,7 @@ impl MyTrait for String { } impl MyTrait for Vec<u8> { - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="type"]/@href' #associatedtype.Assoc + // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="anchor"]/@href' #associatedtype.Assoc-2 type Assoc = (); // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-2"]//a[@class="constant"]/@href' #associatedconstant.VALUE @@ -39,7 +38,7 @@ impl MyTrait for Vec<u8> { impl MyTrait for MyStruct { // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3 - // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc + // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="associatedtype"]/@href' trait.MyTrait.html#associatedtype.Assoc // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc type Assoc = bool; // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3 |
