Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: remove mostly-unused CSS classes import-item and module-item #107336

Merged
merged 1 commit into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
};
write!(
w,
"<div class=\"item-left {stab}{add}import-item\"{id}>\
"<div class=\"item-left{add}{stab}\"{id}>\
<code>{vis}{imp}</code>\
</div>\
{stab_tags_before}{stab_tags}{stab_tags_after}",
Expand Down Expand Up @@ -437,7 +437,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
};
write!(
w,
"<div class=\"item-left {stab}{add}module-item\">\
"<div class=\"item-left{add}{stab}\">\
<a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\
{visibility_emoji}\
{unsafety_flag}\
Expand Down
3 changes: 1 addition & 2 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
0 -1px 0 black;
}

.module-item.unstable,
.import-item.unstable {
.item-left.unstable {
opacity: 0.65;
}

Expand Down
8 changes: 4 additions & 4 deletions tests/rustdoc-gui/label-next-to-symbol.goml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ assert-css: (
// table like view
assert-css: (".item-right.docblock-short", { "padding-left": "0px" })
compare-elements-position-near: (
"//*[@class='item-left module-item']//a[text()='replaced_function']",
"//*[@class='item-left']//a[text()='replaced_function']",
".item-left .stab.deprecated",
{"y": 2},
)
Expand All @@ -32,7 +32,7 @@ compare-elements-position: (

// Ensure no wrap
compare-elements-position: (
"//*[@class='item-left module-item']//a[text()='replaced_function']/..",
"//*[@class='item-left']//a[text()='replaced_function']/..",
"//*[@class='item-right docblock-short'][text()='a thing with a label']",
("y"),
)
Expand All @@ -43,7 +43,7 @@ size: (600, 600)
// staggered layout with 2em spacing
assert-css: (".item-right.docblock-short", { "padding-left": "32px" })
compare-elements-position-near: (
"//*[@class='item-left module-item']//a[text()='replaced_function']",
"//*[@class='item-left']//a[text()='replaced_function']",
".item-left .stab.deprecated",
{"y": 2},
)
Expand All @@ -55,7 +55,7 @@ compare-elements-position: (

// Ensure wrap
compare-elements-position-false: (
"//*[@class='item-left module-item']//a[text()='replaced_function']/..",
"//*[@class='item-left']//a[text()='replaced_function']/..",
"//*[@class='item-right docblock-short'][text()='a thing with a label']",
("y"),
)
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/module-items-font.goml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This test checks that the correct font is used on module items (in index.html pages).
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-css: (
".item-table .module-item a",
".item-table .item-left > a",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
ALL,
)
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc/cfg_doc_reexport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#![no_core]

// @has 'foo/index.html'
// @has - '//*[@class="item-left module-item"]/*[@class="stab portability"]' 'foobar'
// @has - '//*[@class="item-left module-item"]/*[@class="stab portability"]' 'bar'
// @has - '//*[@class="item-left"]/*[@class="stab portability"]' 'foobar'
// @has - '//*[@class="item-left"]/*[@class="stab portability"]' 'bar'

#[doc(cfg(feature = "foobar"))]
mod imp_priv {
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc/deprecated.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @has deprecated/index.html '//*[@class="item-left module-item"]/span[@class="stab deprecated"]' \
// @has deprecated/index.html '//*[@class="item-left"]/span[@class="stab deprecated"]' \
// 'Deprecated'
// @has - '//*[@class="item-right docblock-short"]' 'Deprecated docs'

Expand Down
6 changes: 3 additions & 3 deletions tests/rustdoc/doc-cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Portable;
// @has doc_cfg/unix_only/index.html \
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'Available on Unix only.'
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AARM\Z'
// @matches - '//*[@class="item-left"]//*[@class="stab portability"]' '\AARM\Z'
// @count - '//*[@class="stab portability"]' 2
#[doc(cfg(unix))]
pub mod unix_only {
Expand Down Expand Up @@ -42,7 +42,7 @@ pub mod unix_only {
// @has doc_cfg/wasi_only/index.html \
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'Available on WASI only.'
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z'
// @matches - '//*[@class="item-left"]//*[@class="stab portability"]' '\AWebAssembly\Z'
// @count - '//*[@class="stab portability"]' 2
#[doc(cfg(target_os = "wasi"))]
pub mod wasi_only {
Expand Down Expand Up @@ -74,7 +74,7 @@ pub mod wasi_only {

// the portability header is different on the module view versus the full view
// @has doc_cfg/index.html
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\Aavx\Z'
// @matches - '//*[@class="item-left"]//*[@class="stab portability"]' '\Aavx\Z'

// @has doc_cfg/fn.uses_target_feature.html
// @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc/duplicate-cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#![feature(doc_cfg)]

// @has 'foo/index.html'
// @matches '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]' '^sync$'
// @has '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]/@title' 'Available on crate feature `sync` only'
// @matches '-' '//*[@class="item-left"]//*[@class="stab portability"]' '^sync$'
// @has '-' '//*[@class="item-left"]//*[@class="stab portability"]/@title' 'Available on crate feature `sync` only'

// @has 'foo/struct.Foo.html'
// @has '-' '//*[@class="stab portability"]' 'sync'
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc/glob-shadowing.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @has 'glob_shadowing/index.html'
// @count - '//div[@class="item-left module-item"]' 6
// @count - '//div[@class="item-left"]' 6
// @!has - '//div[@class="item-right docblock-short"]' 'sub1::describe'
// @has - '//div[@class="item-right docblock-short"]' 'sub2::describe'

Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc/inline_cross/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

extern crate macros;

// @has foo/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]' \
// @has foo/index.html '//*[@class="item-left unstable deprecated"]/span[@class="stab deprecated"]' \
// Deprecated
// @has - '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab unstable"]' \
// @has - '//*[@class="item-left unstable deprecated"]/span[@class="stab unstable"]' \
// Experimental

// @has foo/macro.my_macro.html
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc/issue-32374.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#![doc(issue_tracker_base_url = "https://issue_url/")]
#![unstable(feature = "test", issue = "32374")]

// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]' \
// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated"]/span[@class="stab deprecated"]' \
// 'Deprecated'
// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab unstable"]' \
// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated"]/span[@class="stab unstable"]' \
// 'Experimental'
// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/text()' 'Docs'

Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc/issue-55364.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ pub mod subone {
// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo'
// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar'
// Though there should be such links later
// @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.foo.html"]' 'foo'
// @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.bar.html"]' 'bar'
// @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-left"]/a[@class="fn"][@href="fn.foo.html"]' 'foo'
// @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-left"]/a[@class="fn"][@href="fn.bar.html"]' 'bar'
/// See either [foo] or [bar].
pub mod subtwo {

Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc/issue-95873.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// @has issue_95873/index.html "//*[@class='item-left import-item']" "pub use ::std as x;"
// @has issue_95873/index.html "//*[@class='item-left']" "pub use ::std as x;"
pub use ::std as x;
4 changes: 2 additions & 2 deletions tests/rustdoc/reexport-check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
extern crate reexport_check;

// @!has 'foo/index.html' '//code' 'pub use self::i32;'
// @has 'foo/index.html' '//div[@class="item-left deprecated module-item"]' 'i32'
// @has 'foo/index.html' '//div[@class="item-left deprecated"]' 'i32'
// @has 'foo/i32/index.html'
#[allow(deprecated, deprecated_in_future)]
pub use std::i32;
// @!has 'foo/index.html' '//code' 'pub use self::string::String;'
// @has 'foo/index.html' '//div[@class="item-left module-item"]' 'String'
// @has 'foo/index.html' '//div[@class="item-left"]' 'String'
pub use std::string::String;

// @has 'foo/index.html' '//div[@class="item-right docblock-short"]' 'Docs in original'
Expand Down