未验证 提交 f134ca38 编写于 作者: D Dylan DPC 提交者: GitHub

Rollup merge of #83051 - GuillaumeGomez:sidebar-trait-items-order, r=CraftSpider,jyn514

Sidebar trait items order

We were actually sorting `Symbol` and not `String`, creating a completely invalid sort result. I added a test to prevent regressions.

r? ``@jyn514``
......@@ -2122,22 +2122,22 @@ fn print_sidebar_section(
items: &[clean::Item],
before: &str,
filter: impl Fn(&clean::Item) -> bool,
write: impl Fn(&mut Buffer, &Symbol),
write: impl Fn(&mut Buffer, &str),
after: &str,
) {
let mut items = items
.iter()
.filter_map(|m| match m.name {
Some(ref name) if filter(m) => Some(name),
Some(ref name) if filter(m) => Some(name.as_str()),
_ => None,
})
.collect::<Vec<_>>();
if !items.is_empty() {
items.sort();
items.sort_unstable();
out.push_str(before);
for item in items.into_iter() {
write(out, item);
write(out, &item);
}
out.push_str(after);
}
......
......@@ -47,14 +47,19 @@ pub fn some_more_function<T: fmt::Debug>(t: &T) -> String {
/// Woohoo! A trait!
pub trait AnotherOne {
/// Some func 3.
fn func3();
/// Some func 1.
fn func1();
fn another();
fn why_not();
/// Some func 2.
fn func2();
/// Some func 3.
fn func3();
fn hello();
}
/// Check for "i" signs in lists!
......
goto: file://|DOC_PATH|/trait.AnotherOne.html
assert: (".sidebar-links a:nth-of-type(1)", "another")
assert: (".sidebar-links a:nth-of-type(2)", "func1")
assert: (".sidebar-links a:nth-of-type(3)", "func2")
assert: (".sidebar-links a:nth-of-type(4)", "func3")
assert: (".sidebar-links a:nth-of-type(5)", "hello")
assert: (".sidebar-links a:nth-of-type(6)", "why_not")
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册