Skip to content

Commit 52a58f6

Browse files
committed
Auto merge of rust-lang#12160 - Veykril:completions-rev, r=Veykril
minor: Sort ide-completions test outputs for less disruptive diffs
2 parents 01198da + 5280e08 commit 52a58f6

21 files changed

+946
-945
lines changed

crates/ide-completion/src/completions/dot.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ pub mod m {
190190
fn foo(a: lib::m::A) { a.$0 }
191191
"#,
192192
expect![[r#"
193+
fd crate_field u32
193194
fd private_field u32
194195
fd pub_field u32
195-
fd crate_field u32
196196
fd super_field u32
197197
"#]],
198198
);
@@ -248,8 +248,8 @@ mod m {
248248
fn foo(a: lib::A) { a.$0 }
249249
"#,
250250
expect![[r#"
251-
me private_method() fn(&self)
252251
me crate_method() fn(&self)
252+
me private_method() fn(&self)
253253
me pub_method() fn(&self)
254254
"#]],
255255
);
@@ -686,11 +686,11 @@ struct Foo { field: i32 }
686686
impl Foo { fn foo(&self) { $0 } }"#,
687687
expect![[r#"
688688
fd self.field i32
689-
me self.foo() fn(&self)
690689
lc self &Foo
691690
sp Self
692691
st Foo
693692
bt u32
693+
me self.foo() fn(&self)
694694
"#]],
695695
);
696696
check(
@@ -700,11 +700,11 @@ struct Foo(i32);
700700
impl Foo { fn foo(&mut self) { $0 } }"#,
701701
expect![[r#"
702702
fd self.0 i32
703-
me self.foo() fn(&mut self)
704703
lc self &mut Foo
705704
sp Self
706705
st Foo
707706
bt u32
707+
me self.foo() fn(&mut self)
708708
"#]],
709709
);
710710
}

crates/ide-completion/src/completions/keyword.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ mod tests {
205205
r"fn my_fn() { unsafe $0 }",
206206
expect![[r#"
207207
kw fn
208-
kw trait
209208
kw impl
209+
kw trait
210210
sn pd
211211
sn ppd
212212
"#]],
@@ -225,15 +225,15 @@ fn foo(a: A) { a.$0 }
225225
"#,
226226
expect![[r#"
227227
kw await expr.await
228-
sn ref &expr
229-
sn refm &mut expr
230-
sn match match expr {}
231228
sn box Box::new(expr)
229+
sn call function(expr)
232230
sn dbg dbg!(expr)
233231
sn dbgr dbg!(&expr)
234-
sn call function(expr)
235232
sn let let
236233
sn letm let mut
234+
sn match match expr {}
235+
sn ref &expr
236+
sn refm &mut expr
237237
"#]],
238238
);
239239

@@ -248,15 +248,15 @@ fn foo() {
248248
"#,
249249
expect![[r#"
250250
kw await expr.await
251-
sn ref &expr
252-
sn refm &mut expr
253-
sn match match expr {}
254251
sn box Box::new(expr)
252+
sn call function(expr)
255253
sn dbg dbg!(expr)
256254
sn dbgr dbg!(&expr)
257-
sn call function(expr)
258255
sn let let
259256
sn letm let mut
257+
sn match match expr {}
258+
sn ref &expr
259+
sn refm &mut expr
260260
"#]],
261261
)
262262
}

crates/ide-completion/src/completions/mod_.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ fn bar() {}
182182
fn ignored_bar() {}
183183
"#,
184184
expect![[r#"
185-
md foo;
186185
md bar;
186+
md foo;
187187
"#]],
188188
);
189189
}
@@ -219,8 +219,8 @@ fn bar() {}
219219
fn ignored_bar() {}
220220
"#,
221221
expect![[r#"
222-
md foo;
223222
md bar;
223+
md foo;
224224
"#]],
225225
);
226226
}
@@ -346,8 +346,8 @@ fn bar() {}
346346
fn ignored_bar() {}
347347
"#,
348348
expect![[r#"
349-
md foo;
350349
md bar;
350+
md foo;
351351
"#]],
352352
);
353353
}

crates/ide-completion/src/completions/postfix.rs

+24-24
Original file line numberDiff line numberDiff line change
@@ -309,18 +309,18 @@ fn main() {
309309
}
310310
"#,
311311
expect![[r#"
312-
sn if if expr {}
313-
sn while while expr {}
314-
sn not !expr
315-
sn ref &expr
316-
sn refm &mut expr
317-
sn match match expr {}
318312
sn box Box::new(expr)
313+
sn call function(expr)
319314
sn dbg dbg!(expr)
320315
sn dbgr dbg!(&expr)
321-
sn call function(expr)
316+
sn if if expr {}
322317
sn let let
323318
sn letm let mut
319+
sn match match expr {}
320+
sn not !expr
321+
sn ref &expr
322+
sn refm &mut expr
323+
sn while while expr {}
324324
"#]],
325325
);
326326
}
@@ -339,16 +339,16 @@ fn main() {
339339
}
340340
"#,
341341
expect![[r#"
342+
sn box Box::new(expr)
343+
sn call function(expr)
344+
sn dbg dbg!(expr)
345+
sn dbgr dbg!(&expr)
342346
sn if if expr {}
343-
sn while while expr {}
347+
sn match match expr {}
344348
sn not !expr
345349
sn ref &expr
346350
sn refm &mut expr
347-
sn match match expr {}
348-
sn box Box::new(expr)
349-
sn dbg dbg!(expr)
350-
sn dbgr dbg!(&expr)
351-
sn call function(expr)
351+
sn while while expr {}
352352
"#]],
353353
);
354354
}
@@ -363,15 +363,15 @@ fn main() {
363363
}
364364
"#,
365365
expect![[r#"
366-
sn ref &expr
367-
sn refm &mut expr
368-
sn match match expr {}
369366
sn box Box::new(expr)
367+
sn call function(expr)
370368
sn dbg dbg!(expr)
371369
sn dbgr dbg!(&expr)
372-
sn call function(expr)
373370
sn let let
374371
sn letm let mut
372+
sn match match expr {}
373+
sn ref &expr
374+
sn refm &mut expr
375375
"#]],
376376
)
377377
}
@@ -386,18 +386,18 @@ fn main() {
386386
}
387387
"#,
388388
expect![[r#"
389-
sn if if expr {}
390-
sn while while expr {}
391-
sn not !expr
392-
sn ref &expr
393-
sn refm &mut expr
394-
sn match match expr {}
395389
sn box Box::new(expr)
390+
sn call function(expr)
396391
sn dbg dbg!(expr)
397392
sn dbgr dbg!(&expr)
398-
sn call function(expr)
393+
sn if if expr {}
399394
sn let let
400395
sn letm let mut
396+
sn match match expr {}
397+
sn not !expr
398+
sn ref &expr
399+
sn refm &mut expr
400+
sn while while expr {}
401401
"#]],
402402
);
403403
}

crates/ide-completion/src/completions/qualified_path.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ impl S {
249249
fn foo() { let _ = lib::S::$0 }
250250
"#,
251251
expect![[r#"
252-
fn public_method() fn()
253252
ct PUBLIC_CONST pub const PUBLIC_CONST: u32
253+
fn public_method() fn()
254254
ta PublicType pub type PublicType = u32
255255
"#]],
256256
);
@@ -340,14 +340,14 @@ trait Sub: Super {
340340
fn foo<T: Sub>() { T::$0 }
341341
"#,
342342
expect![[r#"
343-
ta SubTy (as Sub) type SubTy
344-
ta Ty (as Super) type Ty
345343
ct C2 (as Sub) const C2: ()
346-
fn subfunc() (as Sub) fn()
347-
me submethod(…) (as Sub) fn(&self)
348344
ct CONST (as Super) const CONST: u8
349345
fn func() (as Super) fn()
346+
fn subfunc() (as Sub) fn()
347+
ta SubTy (as Sub) type SubTy
348+
ta Ty (as Super) type Ty
350349
me method(…) (as Super) fn(&self)
350+
me submethod(…) (as Sub) fn(&self)
351351
"#]],
352352
);
353353
}
@@ -380,13 +380,13 @@ impl<T> Sub for Wrap<T> {
380380
}
381381
"#,
382382
expect![[r#"
383-
ta SubTy (as Sub) type SubTy
384-
ta Ty (as Super) type Ty
383+
ct C2 (as Sub) const C2: ()
385384
ct CONST (as Super) const CONST: u8
386385
fn func() (as Super) fn()
387-
me method(…) (as Super) fn(&self)
388-
ct C2 (as Sub) const C2: ()
389386
fn subfunc() (as Sub) fn()
387+
ta SubTy (as Sub) type SubTy
388+
ta Ty (as Super) type Ty
389+
me method(…) (as Super) fn(&self)
390390
me submethod(…) (as Sub) fn(&self)
391391
"#]],
392392
);
@@ -404,8 +404,8 @@ impl T { fn bar() {} }
404404
fn main() { T::$0; }
405405
"#,
406406
expect![[r#"
407-
fn foo() fn()
408407
fn bar() fn()
408+
fn foo() fn()
409409
"#]],
410410
);
411411
}
@@ -518,8 +518,8 @@ fn main() { m!(self::f$0); }
518518
fn foo() {}
519519
"#,
520520
expect![[r#"
521-
fn main() fn()
522521
fn foo() fn()
522+
fn main() fn()
523523
"#]],
524524
);
525525
}
@@ -536,8 +536,8 @@ mod m {
536536
}
537537
"#,
538538
expect![[r#"
539-
md z
540539
fn z() fn()
540+
md z
541541
"#]],
542542
);
543543
}

crates/ide-completion/src/completions/trait_impl.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ impl Test for T {
343343
",
344344
expect![[r#"
345345
sp Self
346-
tt Test
347346
st T
347+
tt Test
348348
bt u32
349349
"#]],
350350
);
@@ -448,8 +448,8 @@ impl Test for T {
448448
",
449449
expect![[r#"
450450
sp Self
451-
tt Test
452451
st T
452+
tt Test
453453
bt u32
454454
"#]],
455455
);
@@ -465,8 +465,8 @@ impl Test for T {
465465
",
466466
expect![[r#"
467467
sp Self
468-
tt Test
469468
st T
469+
tt Test
470470
bt u32
471471
"#]],
472472
);
@@ -484,8 +484,8 @@ impl Test for T {
484484
",
485485
expect![[r#"
486486
sp Self
487-
tt Test
488487
st T
488+
tt Test
489489
bt u32
490490
"#]],
491491
);
@@ -532,8 +532,8 @@ impl Test for T {
532532
",
533533
expect![[r#"
534534
sp Self
535-
tt Test
536535
st T
536+
tt Test
537537
bt u32
538538
"#]],
539539
);
@@ -549,8 +549,8 @@ impl Test for T {
549549
",
550550
expect![[r#"
551551
sp Self
552-
tt Test
553552
st T
553+
tt Test
554554
bt u32
555555
"#]],
556556
);

crates/ide-completion/src/completions/unqualified_path.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ pub mod prelude {
176176
"#,
177177
expect![[r#"
178178
md std
179-
bt u32
180179
st Option
180+
bt u32
181181
"#]],
182182
);
183183
}
@@ -233,10 +233,10 @@ pub mod prelude {
233233
}
234234
"#,
235235
expect![[r#"
236-
md std
237236
md core
238-
bt u32
237+
md std
239238
st String
239+
bt u32
240240
"#]],
241241
);
242242
}

crates/ide-completion/src/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl CompletionRelevance {
268268
}
269269

270270
/// The type of the completion item.
271-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
271+
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
272272
pub enum CompletionItemKind {
273273
SymbolKind(SymbolKind),
274274
Binding,

crates/ide-completion/src/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ fn completion_list_with_config(
9898
})
9999
.filter(|it| include_keywords || it.kind() != CompletionItemKind::Keyword)
100100
.filter(|it| include_keywords || it.kind() != CompletionItemKind::Snippet)
101+
.sorted_by_key(|it| (it.kind(), it.label().to_owned(), it.detail().map(ToOwned::to_owned)))
101102
.collect();
102103
render_completion_list(items)
103104
}

0 commit comments

Comments
 (0)