mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Omit default types in HirDisplay SourceCode mode
This commit is contained in:
parent
225f353aa2
commit
cbbbd48325
3 changed files with 64 additions and 28 deletions
|
@ -21,3 +21,30 @@ fn bar() {
|
|||
);
|
||||
assert_eq!("foo::Foo", displayed_source_at_pos(&db, pos));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn omit_default_type_parameters() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
r"
|
||||
//- /main.rs
|
||||
struct Foo<T = u8> { t: T }
|
||||
fn main() {
|
||||
let foo = Foo { t: 5 };
|
||||
foo<|>;
|
||||
}
|
||||
",
|
||||
);
|
||||
assert_eq!("Foo", displayed_source_at_pos(&db, pos));
|
||||
|
||||
let (db, pos) = TestDB::with_position(
|
||||
r"
|
||||
//- /main.rs
|
||||
struct Foo<K, T = u8> { k: K, t: T }
|
||||
fn main() {
|
||||
let foo = Foo { k: 400, t: 5 };
|
||||
foo<|>;
|
||||
}
|
||||
",
|
||||
);
|
||||
assert_eq!("Foo<i32>", displayed_source_at_pos(&db, pos));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue