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

Reduce prominence of item-infos #91075

Merged
merged 1 commit into from
Nov 25, 2021
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
18 changes: 1 addition & 17 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ fn short_item_info(

// Render unstable items. But don't render "rustc_private" crates (internal compiler crates).
// Those crates are permanently unstable so it makes no sense to render "unstable" everywhere.
if let Some((StabilityLevel::Unstable { reason, issue, .. }, feature)) = item
if let Some((StabilityLevel::Unstable { reason: _, issue, .. }, feature)) = item
.stability(cx.tcx())
.as_ref()
.filter(|stab| stab.feature != sym::rustc_private)
Expand All @@ -702,22 +702,6 @@ fn short_item_info(

message.push_str(&format!(" ({})", feature));

if let Some(unstable_reason) = reason {
let mut ids = cx.id_map.borrow_mut();
message = format!(
"<details><summary>{}</summary>{}</details>",
message,
MarkdownHtml(
&unstable_reason.as_str(),
&mut ids,
error_codes,
cx.shared.edition(),
&cx.shared.playground,
)
.into_string()
);
}

extra_info.push(format!("<div class=\"stab unstable\">{}</div>", message));
}

Expand Down
4 changes: 1 addition & 3 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,6 @@ body.blur > :not(#help) {
display: table;
}
.stab {
border-width: 1px;
border-style: solid;
padding: 3px;
margin-bottom: 5px;
font-size: 90%;
Expand All @@ -977,7 +975,7 @@ body.blur > :not(#help) {
}

.stab .emoji {
font-size: 1.5em;
font-size: 1.2em;
}

/* Black one-pixel outline around emoji shapes */
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-gui/item-info-width.goml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html
size: (1100, 800)
// We check that ".item-info" is bigger than its content.
assert-css: (".item-info", {"width": "807px"})
assert-css: (".item-info .stab", {"width": "343px"})
assert-css: (".item-info .stab", {"width": "341px"})
9 changes: 1 addition & 8 deletions src/test/rustdoc/issue-32374.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![feature(staged_api)]
#![doc(issue_tracker_base_url = "https://issue_url/")]

#![unstable(feature="test", issue = "32374")]
#![unstable(feature = "test", issue = "32374")]

// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]' \
// 'Deprecated'
Expand All @@ -23,12 +22,6 @@ pub struct T;
// '👎 Deprecated since 1.0.0: deprecated'
// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \
// '🔬 This is a nightly-only experimental API. (test #32374)'
// @has issue_32374/struct.U.html '//details' \
// '🔬 This is a nightly-only experimental API. (test #32374)'
// @has issue_32374/struct.U.html '//summary' \
// '🔬 This is a nightly-only experimental API. (test #32374)'
// @has issue_32374/struct.U.html '//details/p' \
// 'unstable'
#[rustc_deprecated(since = "1.0.0", reason = "deprecated")]
#[unstable(feature = "test", issue = "32374", reason = "unstable")]
pub struct U;