Skip to content

Commit

Permalink
Rollup merge of #107490 - notriddle:notriddle/rm-sidebar-tooltip, r=G…
Browse files Browse the repository at this point in the history
…uillaumeGomez

rustdoc: remove inconsistently-present sidebar tooltips

Discussed in https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Inconsistent.20sidebar.20tooltips/near/323565625
  • Loading branch information
Dylan-DPC authored Feb 11, 2023
2 parents 400b03a + 3a20cbf commit 9af90ff
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 41 deletions.
9 changes: 3 additions & 6 deletions src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::search_index::build_index;
use super::write_shared::write_shared;
use super::{
collect_spans_and_sources, print_sidebar, scrape_examples_help, sidebar_module_like, AllTypes,
LinkFromSrc, NameDoc, StylePath,
LinkFromSrc, StylePath,
};

use crate::clean::{self, types::ExternalLocation, ExternalCrate};
Expand Down Expand Up @@ -256,7 +256,7 @@ impl<'tcx> Context<'tcx> {
}

/// Construct a map of items shown in the sidebar to a plain-text summary of their docs.
fn build_sidebar_items(&self, m: &clean::Module) -> BTreeMap<String, Vec<NameDoc>> {
fn build_sidebar_items(&self, m: &clean::Module) -> BTreeMap<String, Vec<String>> {
// BTreeMap instead of HashMap to get a sorted output
let mut map: BTreeMap<_, Vec<_>> = BTreeMap::new();
let mut inserted: FxHashMap<ItemType, FxHashSet<Symbol>> = FxHashMap::default();
Expand All @@ -274,10 +274,7 @@ impl<'tcx> Context<'tcx> {
if inserted.entry(short).or_default().insert(myname) {
let short = short.to_string();
let myname = myname.to_string();
map.entry(short).or_default().push((
myname,
Some(item.doc_value().map_or_else(String::new, |s| plain_text_summary(&s))),
));
map.entry(short).or_default().push(myname);
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ use crate::scrape_examples::{CallData, CallLocation};
use crate::try_none;
use crate::DOC_RUST_LANG_ORG_CHANNEL;

/// A pair of name and its optional document.
pub(crate) type NameDoc = (String, Option<String>);

pub(crate) fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
crate::html::format::display_fn(move |f| {
if !v.ends_with('/') && !v.is_empty() { write!(f, "{}/", v) } else { f.write_str(v) }
Expand Down
6 changes: 1 addition & 5 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,7 @@ function loadCss(cssUrl) {
const ul = document.createElement("ul");
ul.className = "block " + shortty;

for (const item of filtered) {
const name = item[0];
const desc = item[1]; // can be null

for (const name of filtered) {
let path;
if (shortty === "mod") {
path = name + "/index.html";
Expand All @@ -468,7 +465,6 @@ function loadCss(cssUrl) {
const current_page = document.location.href.split("/").pop();
const link = document.createElement("a");
link.href = path;
link.title = desc;
if (path === current_page) {
link.className = "current";
}
Expand Down
27 changes: 0 additions & 27 deletions tests/rustdoc/markdown-summaries.rs

This file was deleted.

0 comments on commit 9af90ff

Please sign in to comment.