Skip to content

Commit 84b6936

Browse files
authored
Merge pull request #19166 from ChayimFriedman2/runnables-order
fix: Fix sorting of runnables
2 parents 2b485d7 + 353616b commit 84b6936

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

crates/ide/src/annotations.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,7 @@ pub(crate) fn annotations(
173173
annotations
174174
.into_iter()
175175
.sorted_by_key(|a| {
176-
(
177-
a.range.start(),
178-
a.range.end(),
179-
match &a.kind {
180-
AnnotationKind::Runnable(runnable) => Some(runnable.nav.name.clone()),
181-
_ => None,
182-
},
183-
)
176+
(a.range.start(), a.range.end(), matches!(a.kind, AnnotationKind::Runnable(..)))
184177
})
185178
.collect()
186179
}

crates/ide/src/runnables.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ pub enum RunnableKind {
6161

6262
#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
6363
enum RunnableDiscKind {
64-
Test,
6564
TestMod,
65+
Test,
6666
DocTest,
6767
Bench,
6868
Bin,
@@ -1233,8 +1233,8 @@ gen_main!();
12331233
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 0..315, name: \"\", kind: Module })",
12341234
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 267..292, focus_range: 271..276, name: \"tests\", kind: Module, description: \"mod tests\" })",
12351235
"(Test, NavigationTarget { file_id: FileId(0), full_range: 283..290, name: \"foo_test\", kind: Function })",
1236-
"(Test, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"foo_test2\", kind: Function }, true)",
12371236
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"tests2\", kind: Module, description: \"mod tests2\" }, true)",
1237+
"(Test, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"foo_test2\", kind: Function }, true)",
12381238
"(Bin, NavigationTarget { file_id: FileId(0), full_range: 302..314, name: \"main\", kind: Function })",
12391239
]
12401240
"#]],
@@ -1263,10 +1263,10 @@ foo!();
12631263
"#,
12641264
expect![[r#"
12651265
[
1266+
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo_tests\", kind: Module, description: \"mod foo_tests\" }, true)",
12661267
"(Test, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo0\", kind: Function }, true)",
12671268
"(Test, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo1\", kind: Function }, true)",
12681269
"(Test, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo2\", kind: Function }, true)",
1269-
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo_tests\", kind: Module, description: \"mod foo_tests\" }, true)",
12701270
]
12711271
"#]],
12721272
);

0 commit comments

Comments
 (0)