blob: b502135d8e203af545ddfce284dff315d7c4fcb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
use super::check_types_source_code;
#[test]
fn qualify_path_to_submodule() {
check_types_source_code(
r#"
mod foo {
pub struct Foo;
}
fn bar() {
let foo: foo::Foo = foo::Foo;
foo
} //^ foo::Foo
"#,
);
}
#[test]
fn omit_default_type_parameters() {
check_types_source_code(
r#"
struct Foo<T = u8> { t: T }
fn main() {
let foo = Foo { t: 5u8 };
foo;
} //^ Foo
"#,
);
check_types_source_code(
r#"
struct Foo<K, T = u8> { k: K, t: T }
fn main() {
let foo = Foo { k: 400, t: 5u8 };
foo;
} //^ Foo<i32>
"#,
);
}
|