diff options
author | Timo Freiberg <[email protected]> | 2020-05-10 17:09:22 +0100 |
---|---|---|
committer | Timo Freiberg <[email protected]> | 2020-05-10 17:10:15 +0100 |
commit | cbbbd4832582256820695bb73fdb4ca125f1b1f9 (patch) | |
tree | 1d223a7e9f995faa2188efd02115ec21cbaf3913 /crates/ra_hir_ty/src/tests/display_source_code.rs | |
parent | 225f353aa26329260b8c7f69305f616a9edaad70 (diff) |
Omit default types in HirDisplay SourceCode mode
Diffstat (limited to 'crates/ra_hir_ty/src/tests/display_source_code.rs')
-rw-r--r-- | crates/ra_hir_ty/src/tests/display_source_code.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/display_source_code.rs b/crates/ra_hir_ty/src/tests/display_source_code.rs index ca1748615..4088b1d22 100644 --- a/crates/ra_hir_ty/src/tests/display_source_code.rs +++ b/crates/ra_hir_ty/src/tests/display_source_code.rs | |||
@@ -21,3 +21,30 @@ fn bar() { | |||
21 | ); | 21 | ); |
22 | assert_eq!("foo::Foo", displayed_source_at_pos(&db, pos)); | 22 | assert_eq!("foo::Foo", displayed_source_at_pos(&db, pos)); |
23 | } | 23 | } |
24 | |||
25 | #[test] | ||
26 | fn omit_default_type_parameters() { | ||
27 | let (db, pos) = TestDB::with_position( | ||
28 | r" | ||
29 | //- /main.rs | ||
30 | struct Foo<T = u8> { t: T } | ||
31 | fn main() { | ||
32 | let foo = Foo { t: 5 }; | ||
33 | foo<|>; | ||
34 | } | ||
35 | ", | ||
36 | ); | ||
37 | assert_eq!("Foo", displayed_source_at_pos(&db, pos)); | ||
38 | |||
39 | let (db, pos) = TestDB::with_position( | ||
40 | r" | ||
41 | //- /main.rs | ||
42 | struct Foo<K, T = u8> { k: K, t: T } | ||
43 | fn main() { | ||
44 | let foo = Foo { k: 400, t: 5 }; | ||
45 | foo<|>; | ||
46 | } | ||
47 | ", | ||
48 | ); | ||
49 | assert_eq!("Foo<i32>", displayed_source_at_pos(&db, pos)); | ||
50 | } | ||