mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
Fix sorting of runnables
There were two mistakes: first, tests were sorted before test modules, and second, we re-sorted based on the name only, which cancelled the sort based on the kind.
This commit is contained in:
parent
4273bece6f
commit
04ab8373c8
@ -173,14 +173,7 @@ pub(crate) fn annotations(
|
||||
annotations
|
||||
.into_iter()
|
||||
.sorted_by_key(|a| {
|
||||
(
|
||||
a.range.start(),
|
||||
a.range.end(),
|
||||
match &a.kind {
|
||||
AnnotationKind::Runnable(runnable) => Some(runnable.nav.name.clone()),
|
||||
_ => None,
|
||||
},
|
||||
)
|
||||
(a.range.start(), a.range.end(), matches!(a.kind, AnnotationKind::Runnable(..)))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ pub enum RunnableKind {
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
enum RunnableDiscKind {
|
||||
Test,
|
||||
TestMod,
|
||||
Test,
|
||||
DocTest,
|
||||
Bench,
|
||||
Bin,
|
||||
@ -1233,8 +1233,8 @@ gen_main!();
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 0..315, name: \"\", kind: Module })",
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 267..292, focus_range: 271..276, name: \"tests\", kind: Module, description: \"mod tests\" })",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 283..290, name: \"foo_test\", kind: Function })",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"foo_test2\", kind: Function }, true)",
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"tests2\", kind: Module, description: \"mod tests2\" }, true)",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"foo_test2\", kind: Function }, true)",
|
||||
"(Bin, NavigationTarget { file_id: FileId(0), full_range: 302..314, name: \"main\", kind: Function })",
|
||||
]
|
||||
"#]],
|
||||
@ -1263,10 +1263,10 @@ foo!();
|
||||
"#,
|
||||
expect![[r#"
|
||||
[
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo_tests\", kind: Module, description: \"mod foo_tests\" }, true)",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo0\", kind: Function }, true)",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo1\", kind: Function }, true)",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo2\", kind: Function }, true)",
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo_tests\", kind: Module, description: \"mod foo_tests\" }, true)",
|
||||
]
|
||||
"#]],
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user