Skip to content

Commit 6ac5431

Browse files
committed
show 'as' or 'use' before label traits
1 parent b52306e commit 6ac5431

File tree

6 files changed

+37
-37
lines changed

6 files changed

+37
-37
lines changed

crates/ide_completion/src/completions/dot.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl Trait for A {}
250250
fn foo(a: A) { a.$0 }
251251
"#,
252252
expect![[r#"
253-
me the_method() (Trait) fn(&self)
253+
me the_method() (as Trait) fn(&self)
254254
"#]],
255255
);
256256
}
@@ -265,7 +265,7 @@ impl<T> Trait for T {}
265265
fn foo(a: &A) { a.$0 }
266266
",
267267
expect![[r#"
268-
me the_method() (Trait) fn(&self)
268+
me the_method() (as Trait) fn(&self)
269269
"#]],
270270
);
271271
}
@@ -283,7 +283,7 @@ impl Trait for A {}
283283
fn foo(a: A) { a.$0 }
284284
",
285285
expect![[r#"
286-
me the_method() (Trait) fn(&self)
286+
me the_method() (as Trait) fn(&self)
287287
"#]],
288288
);
289289
}

crates/ide_completion/src/completions/flyimport.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ fn main() {
404404
check(
405405
fixture,
406406
expect![[r#"
407-
fn weird_function() (dep::test_mod::TestTrait) fn()
407+
fn weird_function() (use dep::test_mod::TestTrait) fn()
408408
"#]],
409409
);
410410

@@ -450,7 +450,7 @@ fn main() {
450450
check(
451451
fixture,
452452
expect![[r#"
453-
ct SPECIAL_CONST (dep::test_mod::TestTrait)
453+
ct SPECIAL_CONST (use dep::test_mod::TestTrait)
454454
"#]],
455455
);
456456

@@ -497,7 +497,7 @@ fn main() {
497497
check(
498498
fixture,
499499
expect![[r#"
500-
me random_method() (dep::test_mod::TestTrait) fn(&self)
500+
me random_method() (use dep::test_mod::TestTrait) fn(&self)
501501
"#]],
502502
);
503503

@@ -667,7 +667,7 @@ fn main() {
667667
}
668668
"#,
669669
expect![[r#"
670-
me random_method() (dep::test_mod::TestTrait) fn(&self) DEPRECATED
670+
me random_method() (use dep::test_mod::TestTrait) fn(&self) DEPRECATED
671671
"#]],
672672
);
673673

@@ -697,8 +697,8 @@ fn main() {
697697
}
698698
"#,
699699
expect![[r#"
700-
ct SPECIAL_CONST (dep::test_mod::TestTrait) DEPRECATED
701-
fn weird_function() (dep::test_mod::TestTrait) fn() DEPRECATED
700+
ct SPECIAL_CONST (use dep::test_mod::TestTrait) DEPRECATED
701+
fn weird_function() (use dep::test_mod::TestTrait) fn() DEPRECATED
702702
"#]],
703703
);
704704
}
@@ -859,7 +859,7 @@ fn main() {
859859
check(
860860
fixture,
861861
expect![[r#"
862-
ct TEST_ASSOC (foo::Item)
862+
ct TEST_ASSOC (use foo::Item)
863863
"#]],
864864
);
865865

@@ -903,7 +903,7 @@ fn main() {
903903
check(
904904
fixture,
905905
expect![[r#"
906-
ct TEST_ASSOC (foo::bar::Item)
906+
ct TEST_ASSOC (use foo::bar::Item)
907907
"#]],
908908
);
909909

@@ -1015,7 +1015,7 @@ fn main() {
10151015
}"#,
10161016
expect![[r#"
10171017
ct foo::TEST_CONST
1018-
fn test_function() (foo::test_function) fn() -> i32
1018+
fn test_function() (use foo::test_function) fn() -> i32
10191019
"#]],
10201020
);
10211021

@@ -1072,7 +1072,7 @@ fn main() {
10721072
}
10731073
"#,
10741074
expect![[r#"
1075-
fn some_fn() (m::some_fn) fn() -> i32
1075+
fn some_fn() (use m::some_fn) fn() -> i32
10761076
"#]],
10771077
);
10781078
}

crates/ide_completion/src/completions/qualified_path.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ trait Trait { fn m(); }
333333
fn foo() { let _ = Trait::$0 }
334334
"#,
335335
expect![[r#"
336-
fn m() (Trait) fn()
336+
fn m() (as Trait) fn()
337337
"#]],
338338
);
339339
}
@@ -350,7 +350,7 @@ impl Trait for S {}
350350
fn foo() { let _ = S::$0 }
351351
"#,
352352
expect![[r#"
353-
fn m() (Trait) fn()
353+
fn m() (as Trait) fn()
354354
"#]],
355355
);
356356
}
@@ -367,7 +367,7 @@ impl Trait for S {}
367367
fn foo() { let _ = <S as Trait>::$0 }
368368
"#,
369369
expect![[r#"
370-
fn m() (Trait) fn()
370+
fn m() (as Trait) fn()
371371
"#]],
372372
);
373373
}
@@ -393,14 +393,14 @@ trait Sub: Super {
393393
fn foo<T: Sub>() { T::$0 }
394394
"#,
395395
expect![[r#"
396-
ta SubTy (Sub) type SubTy;
397-
ta Ty (Super) type Ty;
398-
ct C2 (Sub) const C2: ();
399-
fn subfunc() (Sub) fn()
400-
me submethod(…) (Sub) fn(&self)
401-
ct CONST (Super) const CONST: u8;
402-
fn func() (Super) fn()
403-
me method(…) (Super) fn(&self)
396+
ta SubTy (as Sub) type SubTy;
397+
ta Ty (as Super) type Ty;
398+
ct C2 (as Sub) const C2: ();
399+
fn subfunc() (as Sub) fn()
400+
me submethod(…) (as Sub) fn(&self)
401+
ct CONST (as Super) const CONST: u8;
402+
fn func() (as Super) fn()
403+
me method(…) (as Super) fn(&self)
404404
"#]],
405405
);
406406
}
@@ -433,14 +433,14 @@ impl<T> Sub for Wrap<T> {
433433
}
434434
"#,
435435
expect![[r#"
436-
ta SubTy (Sub) type SubTy;
437-
ta Ty (Super) type Ty;
438-
ct CONST (Super) const CONST: u8 = 0;
439-
fn func() (Super) fn()
440-
me method(…) (Super) fn(&self)
441-
ct C2 (Sub) const C2: () = ();
442-
fn subfunc() (Sub) fn()
443-
me submethod(…) (Sub) fn(&self)
436+
ta SubTy (as Sub) type SubTy;
437+
ta Ty (as Super) type Ty;
438+
ct CONST (as Super) const CONST: u8 = 0;
439+
fn func() (as Super) fn()
440+
me method(…) (as Super) fn(&self)
441+
ct C2 (as Sub) const C2: () = ();
442+
fn subfunc() (as Sub) fn()
443+
me submethod(…) (as Sub) fn(&self)
444444
"#]],
445445
);
446446
}

crates/ide_completion/src/item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,10 @@ impl Builder {
434434
if original_path_label.ends_with(&label) {
435435
label = original_path_label;
436436
} else {
437-
format_to!(label, " ({})", original_path)
437+
format_to!(label, " (use {})", original_path)
438438
}
439439
} else if let Some(trait_name) = self.trait_name {
440-
format_to!(label, " ({})", trait_name)
440+
format_to!(label, " (as {})", trait_name)
441441
}
442442

443443
let text_edit = match self.text_edit {

crates/ide_completion/src/render.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ fn main() {
13791379
"#,
13801380
expect![[r#"
13811381
sn not [snippet]
1382-
me not() (ops::Not) [type_could_unify]
1382+
me not() (use ops::Not) [type_could_unify]
13831383
sn if []
13841384
sn while []
13851385
sn ref []

crates/ide_completion/src/tests/type_pos.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ trait Trait2 {
140140
fn foo<'lt, T: Trait2<$0>, const CONST_PARAM: usize>(_: T) {}
141141
"#,
142142
expect![[r#"
143-
ta Foo = (Trait2) type Foo;
143+
ta Foo = (as Trait2) type Foo;
144144
tp T
145145
cp CONST_PARAM
146146
tt Trait
@@ -151,7 +151,7 @@ fn foo<'lt, T: Trait2<$0>, const CONST_PARAM: usize>(_: T) {}
151151
md module
152152
st Unit
153153
ct CONST
154-
ma makro!(…) macro_rules! makro
154+
ma makro!(…) macro_rules! makro
155155
bt u32
156156
"#]],
157157
);

0 commit comments

Comments
 (0)