Skip to content

Add methods properties in emoji to sidebar #67871

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

Closed
wants to merge 2 commits into from
Closed
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
24 changes: 19 additions & 5 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4063,11 +4063,25 @@ fn get_methods(
.filter_map(|item| match item.name {
Some(ref name) if !name.is_empty() && item.is_method() => {
if !for_deref || should_render_item(item, deref_mut) {
Some(format!(
"<a href=\"#{}\">{}</a>",
get_next_url(used_links, format!("method.{}", name)),
name
))
let mut emojis = String::new();
if let clean::FunctionItem(ref func) | clean::ForeignFunctionItem(ref func) = item.inner {
if func.header.unsafety == hir::Unsafety::Unsafe {
emojis += "⚠";
}
}
if let Some(stab) = item.stability.as_ref().filter(|stab| stab.level == stability::Unstable) {
let is_rustc_private = stab.feature.as_deref() == Some("rustc_private");
emojis += if is_rustc_private { "⚙️" } else { "🔬" };
};
if item.deprecation().is_some() {
emojis += "⚰️";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this better

Suggested change
emojis += "⚰️";
emojis += "🔥";

Copy link
Contributor

@euclio euclio Jan 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other options to consider:

  • 👎
  • 🕸
  • 🚨
  • 🚧
  • 🛑
  • 🚫
  • 🟡
  • 🟨
  • 🚩
  • ⚠️

I'm personally partial to 🚧 (followed by 🚩). think they convey the message of "hey, pay attention, this will go away at some point" without being too strong.

EDIT: 🚧 may have too much of a "under construction, stabilizing" connotation than we would like, though.

Copy link
Contributor

@euclio euclio Jan 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, notably, MDN uses 👎 for deprecated APIs.

Copy link
Contributor Author

@pickfire pickfire Jan 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should bikeshed which emoji to use, right now there is not one to use. The one I suggested is a coffin. I think I prefer 👎. Can there even be a vote or something for this?

}
if !emojis.is_empty() {
emojis.insert_str(0, "<sup>");
emojis.push_str("</sup>");
}
let url = get_next_url(used_links, format!("method.{}", name));
Some(format!("<a href=\"#{}\">{}{}</a>", url, name, emojis))
} else {
None
}
Expand Down