2254: Auto-upgrade some insta snapshots r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2019-11-15 09:57:00 +00:00 committed by GitHub
commit e1b7af43e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 1643 additions and 1596 deletions

View file

@ -254,7 +254,6 @@ fn test(a: u32, b: isize, c: !, d: &str) {
1.0f32; 1.0f32;
}"#), }"#),
@r###" @r###"
[9; 10) 'a': u32 [9; 10) 'a': u32
[17; 18) 'b': isize [17; 18) 'b': isize
[27; 28) 'c': ! [27; 28) 'c': !
@ -317,7 +316,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[15; 20) '{ 1 }': u32 [15; 20) '{ 1 }': u32
[17; 18) '1': u32 [17; 18) '1': u32
[48; 53) '{ 1 }': u32 [48; 53) '{ 1 }': u32
@ -354,7 +352,7 @@ fn test() {
[66; 74) 'S::foo()': i32 [66; 74) 'S::foo()': i32
[80; 88) '<S>::foo': fn foo() -> i32 [80; 88) '<S>::foo': fn foo() -> i32
[80; 90) '<S>::foo()': i32 [80; 90) '<S>::foo()': i32
"### "###
); );
} }
@ -409,7 +407,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[72; 154) '{ ...a.c; }': () [72; 154) '{ ...a.c; }': ()
[82; 83) 'c': C [82; 83) 'c': C
[86; 87) 'C': C(usize) -> C [86; 87) 'C': C(usize) -> C
@ -443,7 +440,6 @@ fn test() {
E::V2; E::V2;
}"#), }"#),
@r###" @r###"
[48; 82) '{ E:...:V2; }': () [48; 82) '{ E:...:V2; }': ()
[52; 70) 'E::V1 ...d: 1 }': E [52; 70) 'E::V1 ...d: 1 }': E
[67; 68) '1': u32 [67; 68) '1': u32
@ -471,7 +467,6 @@ fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) {
} }
"#), "#),
@r###" @r###"
[9; 10) 'a': &u32 [9; 10) 'a': &u32
[18; 19) 'b': &mut u32 [18; 19) 'b': &mut u32
[31; 32) 'c': *const u32 [31; 32) 'c': *const u32
@ -524,7 +519,6 @@ fn test() {
} }
"##), "##),
@r###" @r###"
[11; 221) '{ ...o"#; }': () [11; 221) '{ ...o"#; }': ()
[17; 21) '5i32': i32 [17; 21) '5i32': i32
[27; 31) '5f32': f32 [27; 31) '5f32': f32
@ -568,7 +562,6 @@ fn test(x: SomeType) {
} }
"#), "#),
@r###" @r###"
[27; 28) 'x': SomeType [27; 28) 'x': SomeType
[40; 272) '{ ...lo"; }': () [40; 272) '{ ...lo"; }': ()
[50; 51) 'b': bool [50; 51) 'b': bool
@ -632,7 +625,6 @@ fn test() -> &mut &f64 {
} }
"#), "#),
@r###" @r###"
[14; 15) 'x': u32 [14; 15) 'x': u32
[22; 24) '{}': () [22; 24) '{}': ()
[78; 231) '{ ...t &c }': &mut &f64 [78; 231) '{ ...t &c }': &mut &f64
@ -679,7 +671,6 @@ impl S {
} }
"#), "#),
@r###" @r###"
[34; 38) 'self': &S [34; 38) 'self': &S
[40; 61) '{ ... }': () [40; 61) '{ ... }': ()
[50; 54) 'self': &S [50; 54) 'self': &S
@ -719,7 +710,6 @@ fn test() -> bool {
} }
"#), "#),
@r###" @r###"
[6; 7) 'x': bool [6; 7) 'x': bool
[22; 34) '{ 0i32 }': i32 [22; 34) '{ 0i32 }': i32
[28; 32) '0i32': i32 [28; 32) '0i32': i32
@ -802,7 +792,6 @@ fn test2(a1: *const A, a2: *mut A) {
} }
"#), "#),
@r###" @r###"
[44; 45) 'a': A [44; 45) 'a': A
[50; 213) '{ ...5.b; }': () [50; 213) '{ ...5.b; }': ()
[60; 62) 'a1': A [60; 62) 'a1': A
@ -970,7 +959,7 @@ fn test(a: A<i32>) {
[374; 375) 'B': B<A<i32>>(T) -> B<T> [374; 375) 'B': B<A<i32>>(T) -> B<T>
[374; 378) 'B(a)': B<A<i32>> [374; 378) 'B(a)': B<A<i32>>
[376; 377) 'a': A<i32> [376; 377) 'a': A<i32>
"### "###
); );
} }
@ -983,7 +972,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[11; 37) '{ l... {}; }': () [11; 37) '{ l... {}; }': ()
[20; 21) 'x': () [20; 21) 'x': ()
[24; 34) 'if true {}': () [24; 34) 'if true {}': ()
@ -1105,7 +1093,6 @@ fn test(a: A) {
} }
"#), "#),
@r###" @r###"
[32; 36) 'self': A [32; 36) 'self': A
[38; 39) 'x': u32 [38; 39) 'x': u32
[53; 55) '{}': () [53; 55) '{}': ()
@ -1142,7 +1129,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[40; 44) 'self': &str [40; 44) 'self': &str
[53; 55) '{}': () [53; 55) '{}': ()
[69; 89) '{ ...o(); }': () [69; 89) '{ ...o(); }': ()
@ -1166,7 +1152,6 @@ fn test(x: &str, y: isize) {
} }
"#), "#),
@r###" @r###"
[9; 10) 'x': &str [9; 10) 'x': &str
[18; 19) 'y': isize [18; 19) 'y': isize
[28; 170) '{ ...d"); }': () [28; 170) '{ ...d"); }': ()
@ -1367,7 +1352,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[28; 79) '{ ...(1); }': () [28; 79) '{ ...(1); }': ()
[38; 42) 'A(n)': A<i32> [38; 42) 'A(n)': A<i32>
[40; 41) 'n': &i32 [40; 41) 'n': &i32
@ -1396,7 +1380,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[11; 57) '{ ...= v; }': () [11; 57) '{ ...= v; }': ()
[21; 22) 'v': &(i32, &i32) [21; 22) 'v': &(i32, &i32)
[25; 33) '&(1, &2)': &(i32, &i32) [25; 33) '&(1, &2)': &(i32, &i32)
@ -1441,7 +1424,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[68; 289) '{ ... d; }': () [68; 289) '{ ... d; }': ()
[78; 79) 'e': E [78; 79) 'e': E
[82; 95) 'E::A { x: 3 }': E [82; 95) 'E::A { x: 3 }': E
@ -1488,7 +1470,6 @@ fn test(a1: A<u32>, i: i32) {
} }
"#), "#),
@r###" @r###"
[36; 38) 'a1': A<u32> [36; 38) 'a1': A<u32>
[48; 49) 'i': i32 [48; 49) 'i': i32
[56; 147) '{ ...3.x; }': () [56; 147) '{ ...3.x; }': ()
@ -1569,7 +1550,6 @@ fn test(a1: A<u32>, o: Option<u64>) {
} }
"#), "#),
@r###" @r###"
[79; 81) 'a1': A<u32> [79; 81) 'a1': A<u32>
[91; 92) 'o': Option<u64> [91; 92) 'o': Option<u64>
[107; 244) '{ ... }; }': () [107; 244) '{ ... }; }': ()
@ -1604,7 +1584,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[10; 11) 't': T [10; 11) 't': T
[21; 26) '{ t }': T [21; 26) '{ t }': T
[23; 24) 't': T [23; 24) 't': T
@ -1652,7 +1631,6 @@ fn test() -> i128 {
} }
"#), "#),
@r###" @r###"
[74; 78) 'self': A<X, Y> [74; 78) 'self': A<X, Y>
[85; 107) '{ ... }': X [85; 107) '{ ... }': X
[95; 99) 'self': A<X, Y> [95; 99) 'self': A<X, Y>
@ -1706,7 +1684,6 @@ fn test(o: Option<u32>) {
} }
"#), "#),
@r###" @r###"
[78; 82) 'self': &Option<T> [78; 82) 'self': &Option<T>
[98; 100) '{}': () [98; 100) '{}': ()
[111; 112) 'o': Option<u32> [111; 112) 'o': Option<u32>
@ -1744,7 +1721,6 @@ fn test() -> i128 {
} }
"#), "#),
@r###" @r###"
[53; 57) 'self': A<T2> [53; 57) 'self': A<T2>
[65; 87) '{ ... }': T2 [65; 87) '{ ... }': T2
[75; 79) 'self': A<T2> [75; 79) 'self': A<T2>
@ -1921,7 +1897,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[56; 64) '{ A {} }': A [56; 64) '{ A {} }': A
[58; 62) 'A {}': A [58; 62) 'A {}': A
[126; 132) '{ 99 }': u32 [126; 132) '{ 99 }': u32
@ -1961,7 +1936,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[64; 67) 'val': T [64; 67) 'val': T
[82; 109) '{ ... }': Gen<T> [82; 109) '{ ... }': Gen<T>
[92; 103) 'Gen { val }': Gen<T> [92; 103) 'Gen { val }': Gen<T>
@ -2129,7 +2103,6 @@ fn test(x: X) {
} }
"#), "#),
@r###" @r###"
[20; 21) 'x': X [20; 21) 'x': X
[26; 47) '{ ...eld; }': () [26; 47) '{ ...eld; }': ()
[32; 33) 'x': X [32; 33) 'x': X
@ -2151,7 +2124,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[11; 89) '{ ... } }': () [11; 89) '{ ... } }': ()
[17; 21) 'X {}': {unknown} [17; 21) 'X {}': {unknown}
[27; 87) 'match ... }': () [27; 87) 'match ... }': ()
@ -2174,7 +2146,6 @@ fn quux() {
} }
"#), "#),
@r###" @r###"
[11; 41) '{ ...+ y; }': () [11; 41) '{ ...+ y; }': ()
[21; 22) 'y': i32 [21; 22) 'y': i32
[25; 27) '92': i32 [25; 27) '92': i32
@ -2300,7 +2271,6 @@ fn write() {
} }
"#), "#),
@r###" @r###"
[54; 139) '{ ... } }': () [54; 139) '{ ... } }': ()
[60; 137) 'match ... }': () [60; 137) 'match ... }': ()
[66; 83) 'someth...nknown': Maybe<{unknown}> [66; 83) 'someth...nknown': Maybe<{unknown}>
@ -2322,7 +2292,6 @@ fn test_line_buffer() {
} }
"#), "#),
@r###" @r###"
[23; 53) '{ ...n']; }': () [23; 53) '{ ...n']; }': ()
[29; 50) '&[0, b...b'\n']': &[u8;_] [29; 50) '&[0, b...b'\n']': &[u8;_]
[30; 50) '[0, b'...b'\n']': [u8;_] [30; 50) '[0, b'...b'\n']': [u8;_]
@ -2446,7 +2415,6 @@ fn test<R>(query_response: Canonical<QueryResponse<R>>) {
} }
"#), "#),
@r###" @r###"
[92; 106) 'query_response': Canonical<QueryResponse<R>> [92; 106) 'query_response': Canonical<QueryResponse<R>>
[137; 167) '{ ...lue; }': () [137; 167) '{ ...lue; }': ()
[143; 164) '&query....value': &QueryResponse<R> [143; 164) '&query....value': &QueryResponse<R>
@ -2472,7 +2440,6 @@ pub fn main_loop() {
} }
"#), "#),
@r###" @r###"
[144; 146) '{}': () [144; 146) '{}': ()
[169; 198) '{ ...t(); }': () [169; 198) '{ ...t(); }': ()
[175; 193) 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<T, H> [175; 193) 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<T, H>
@ -2518,7 +2485,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[49; 50) '0': u32 [49; 50) '0': u32
[80; 83) '101': u32 [80; 83) '101': u32
[95; 213) '{ ...NST; }': () [95; 213) '{ ...NST; }': ()
@ -2549,7 +2515,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[29; 32) '101': u32 [29; 32) '101': u32
[70; 73) '101': u32 [70; 73) '101': u32
[85; 280) '{ ...MUT; }': () [85; 280) '{ ...MUT; }': ()
@ -2588,7 +2553,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[31; 35) 'self': &Self [31; 35) 'self': &Self
[110; 114) 'self': &Self [110; 114) 'self': &Self
[170; 228) '{ ...i128 }': () [170; 228) '{ ...i128 }': ()
@ -2636,7 +2600,6 @@ mod bar_test {
} }
"#), "#),
@r###" @r###"
[63; 67) 'self': &Self [63; 67) 'self': &Self
[169; 173) 'self': &Self [169; 173) 'self': &Self
[300; 337) '{ ... }': () [300; 337) '{ ... }': ()
@ -2664,7 +2627,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[33; 37) 'self': &Self [33; 37) 'self': &Self
[92; 111) '{ ...d(); }': () [92; 111) '{ ...d(); }': ()
[98; 99) 'S': S [98; 99) 'S': S
@ -2694,7 +2656,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[43; 47) 'self': &Self [43; 47) 'self': &Self
[82; 86) 'self': &Self [82; 86) 'self': &Self
[210; 361) '{ ..., i8 }': () [210; 361) '{ ..., i8 }': ()
@ -2725,7 +2686,6 @@ fn test() {
} }
"#), "#),
@r###" @r###"
[33; 37) 'self': &Self [33; 37) 'self': &Self
[102; 127) '{ ...d(); }': () [102; 127) '{ ...d(); }': ()
[108; 109) 'S': S<u32>(T) -> S<T> [108; 109) 'S': S<u32>(T) -> S<T>
@ -3130,7 +3090,6 @@ fn test<T: Iterable<Item=u32>>() {
} }
"#), "#),
@r###" @r###"
[67; 100) '{ ...own; }': () [67; 100) '{ ...own; }': ()
[77; 78) 'y': {unknown} [77; 78) 'y': {unknown}
[90; 97) 'unknown': {unknown} [90; 97) 'unknown': {unknown}
@ -3146,7 +3105,6 @@ const A: u32 = 1 + 1;
static B: u64 = { let x = 1; x }; static B: u64 = { let x = 1; x };
"#), "#),
@r###" @r###"
[16; 17) '1': u32 [16; 17) '1': u32
[16; 21) '1 + 1': u32 [16; 21) '1 + 1': u32
[20; 21) '1': u32 [20; 21) '1': u32
@ -3170,7 +3128,6 @@ fn test() -> u64 {
} }
"#), "#),
@r###" @r###"
[38; 87) '{ ... a.1 }': u64 [38; 87) '{ ... a.1 }': u64
[48; 49) 'a': S [48; 49) 'a': S
[52; 53) 'S': S(i32, u64) -> S [52; 53) 'S': S(i32, u64) -> S
@ -3225,7 +3182,6 @@ fn indexing_arrays() {
assert_snapshot!( assert_snapshot!(
infer("fn main() { &mut [9][2]; }"), infer("fn main() { &mut [9][2]; }"),
@r###" @r###"
[10; 26) '{ &mut...[2]; }': () [10; 26) '{ &mut...[2]; }': ()
[12; 23) '&mut [9][2]': &mut {unknown} [12; 23) '&mut [9][2]': &mut {unknown}
[17; 20) '[9]': [i32;_] [17; 20) '[9]': [i32;_]
@ -4822,9 +4778,9 @@ fn main() {
} }
"#), "#),
@r###" @r###"
![0; 1) '6': i32 ![0; 1) '6': i32
[64; 88) '{ ...!(); }': () [64; 88) '{ ...!(); }': ()
[74; 75) 'x': i32 [74; 75) 'x': i32
"### "###
); );
} }

View file

@ -88,16 +88,16 @@ mod tests {
", ",
), ),
@r###" @r###"
[ [
CompletionItem { CompletionItem {
label: "the_field", label: "the_field",
source_range: [94; 94), source_range: [94; 94),
delete: [94; 94), delete: [94; 94),
insert: "the_field", insert: "the_field",
kind: Field, kind: Field,
detail: "u32", detail: "u32",
}, },
] ]
"### "###
); );
} }
@ -349,24 +349,24 @@ mod tests {
", ",
), ),
@r###" @r###"
[ [
CompletionItem { CompletionItem {
label: "0", label: "0",
source_range: [75; 75), source_range: [75; 75),
delete: [75; 75), delete: [75; 75),
insert: "0", insert: "0",
kind: Field, kind: Field,
detail: "i32", detail: "i32",
}, },
CompletionItem { CompletionItem {
label: "1", label: "1",
source_range: [75; 75), source_range: [75; 75),
delete: [75; 75), delete: [75; 75),
insert: "1", insert: "1",
kind: Field, kind: Field,
detail: "f64", detail: "f64",
}, },
] ]
"### "###
); );
} }
@ -419,16 +419,16 @@ mod tests {
", ",
), ),
@r###" @r###"
[ [
CompletionItem { CompletionItem {
label: "the_field", label: "the_field",
source_range: [106; 106), source_range: [106; 106),
delete: [106; 106), delete: [106; 106),
insert: "the_field", insert: "the_field",
kind: Field, kind: Field,
detail: "u32", detail: "u32",
}, },
] ]
"### "###
); );
} }
@ -452,15 +452,15 @@ mod tests {
} }
"###, CompletionKind::Keyword), "###, CompletionKind::Keyword),
@r###" @r###"
[ [
CompletionItem { CompletionItem {
label: "await", label: "await",
source_range: [74; 74), source_range: [74; 74),
delete: [74; 74), delete: [74; 74),
insert: "await", insert: "await",
detail: "expr.await", detail: "expr.await",
}, },
] ]
"### "###
) )
} }

View file

@ -70,15 +70,15 @@ mod tests {
", ",
), ),
@r###" @r###"
[ [
CompletionItem { CompletionItem {
label: "file_id: FileId", label: "file_id: FileId",
source_range: [110; 114), source_range: [110; 114),
delete: [110; 114), delete: [110; 114),
insert: "file_id: FileId", insert: "file_id: FileId",
lookup: "file_id", lookup: "file_id",
}, },
] ]
"### "###
); );
} }
@ -94,15 +94,15 @@ mod tests {
", ",
), ),
@r###" @r###"
[ [
CompletionItem { CompletionItem {
label: "file_id: FileId", label: "file_id: FileId",
source_range: [110; 114), source_range: [110; 114),
delete: [110; 114), delete: [110; 114),
insert: "file_id: FileId", insert: "file_id: FileId",
lookup: "file_id", lookup: "file_id",
}, },
] ]
"### "###
); );
} }
@ -121,15 +121,15 @@ mod tests {
", ",
), ),
@r###" @r###"
[ [
CompletionItem { CompletionItem {
label: "file_id: FileId", label: "file_id: FileId",
source_range: [289; 293), source_range: [289; 293),
delete: [289; 293), delete: [289; 293),
insert: "file_id: FileId", insert: "file_id: FileId",
lookup: "file_id", lookup: "file_id",
}, },
] ]
"### "###
); );
} }

File diff suppressed because it is too large Load diff

View file

@ -37,16 +37,18 @@ mod tests {
<|> <|>
" "
), ),
@r##"[ @r###"
CompletionItem { [
label: "foo!", CompletionItem {
source_range: [46; 46), label: "foo!",
delete: [46; 46), source_range: [46; 46),
insert: "foo!($0)", delete: [46; 46),
kind: Macro, insert: "foo!($0)",
detail: "macro_rules! foo", kind: Macro,
}, detail: "macro_rules! foo",
]"## },
]
"###
); );
} }
@ -75,19 +77,21 @@ mod tests {
<|> <|>
" "
), ),
@r##"[ @r###"
CompletionItem { [
label: "vec!", CompletionItem {
source_range: [280; 280), label: "vec!",
delete: [280; 280), source_range: [280; 280),
insert: "vec![$0]", delete: [280; 280),
kind: Macro, insert: "vec![$0]",
detail: "macro_rules! vec", kind: Macro,
documentation: Documentation( detail: "macro_rules! vec",
"Creates a [`Vec`] containing the arguments.\n\n- Create a [`Vec`] containing a given list of elements:\n\n```\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```", documentation: Documentation(
), "Creates a [`Vec`] containing the arguments.\n\n- Create a [`Vec`] containing a given list of elements:\n\n```\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```",
}, ),
]"## },
]
"###
); );
} }
@ -110,28 +114,29 @@ mod tests {
} }
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "foo!", CompletionItem {
source_range: [163; 163), label: "foo!",
delete: [163; 163), source_range: [163; 163),
insert: "foo! {$0}", delete: [163; 163),
kind: Macro, insert: "foo! {$0}",
detail: "macro_rules! foo", kind: Macro,
documentation: Documentation( detail: "macro_rules! foo",
"Foo\n\nNot call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`.\nCall as `let _=foo! { hello world };`", documentation: Documentation(
), "Foo\n\nNot call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`.\nCall as `let _=foo! { hello world };`",
}, ),
CompletionItem { },
label: "main()", CompletionItem {
source_range: [163; 163), label: "main()",
delete: [163; 163), source_range: [163; 163),
insert: "main()$0", delete: [163; 163),
kind: Function, insert: "main()$0",
lookup: "main", kind: Function,
detail: "fn main()", lookup: "main",
}, detail: "fn main()",
] },
]
"### "###
); );
} }

View file

@ -152,18 +152,20 @@ mod tests {
} }
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "my", CompletionItem {
source_range: [27; 29), label: "my",
delete: [27; 29), source_range: [27; 29),
insert: "my", delete: [27; 29),
kind: Module, insert: "my",
documentation: Documentation( kind: Module,
"Some simple\ndocs describing `mod my`.", documentation: Documentation(
), "Some simple\ndocs describing `mod my`.",
}, ),
]"### },
]
"###
); );
} }
@ -179,15 +181,17 @@ mod tests {
} }
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "Bar", CompletionItem {
source_range: [30; 30), label: "Bar",
delete: [30; 30), source_range: [30; 30),
insert: "Bar", delete: [30; 30),
kind: Struct, insert: "Bar",
}, kind: Struct,
]"### },
]
"###
); );
} }
@ -203,22 +207,24 @@ mod tests {
use crate::Sp<|> use crate::Sp<|>
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "Spam", CompletionItem {
source_range: [11; 13), label: "Spam",
delete: [11; 13), source_range: [11; 13),
insert: "Spam", delete: [11; 13),
kind: Struct, insert: "Spam",
}, kind: Struct,
CompletionItem { },
label: "foo", CompletionItem {
source_range: [11; 13), label: "foo",
delete: [11; 13), source_range: [11; 13),
insert: "foo", delete: [11; 13),
kind: Module, insert: "foo",
}, kind: Module,
]"### },
]
"###
); );
} }
@ -234,22 +240,24 @@ mod tests {
use crate::{Sp<|>}; use crate::{Sp<|>};
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "Spam", CompletionItem {
source_range: [12; 14), label: "Spam",
delete: [12; 14), source_range: [12; 14),
insert: "Spam", delete: [12; 14),
kind: Struct, insert: "Spam",
}, kind: Struct,
CompletionItem { },
label: "foo", CompletionItem {
source_range: [12; 14), label: "foo",
delete: [12; 14), source_range: [12; 14),
insert: "foo", delete: [12; 14),
kind: Module, insert: "foo",
}, kind: Module,
]"### },
]
"###
); );
} }
@ -269,15 +277,17 @@ mod tests {
use crate::{bar::{baz::Sp<|>}}; use crate::{bar::{baz::Sp<|>}};
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "Spam", CompletionItem {
source_range: [23; 25), label: "Spam",
delete: [23; 25), source_range: [23; 25),
insert: "Spam", delete: [23; 25),
kind: Struct, insert: "Spam",
}, kind: Struct,
]"### },
]
"###
); );
} }
@ -297,30 +307,32 @@ mod tests {
fn foo() { let _ = E::<|> } fn foo() { let _ = E::<|> }
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "Bar", CompletionItem {
source_range: [116; 116), label: "Bar",
delete: [116; 116), source_range: [116; 116),
insert: "Bar", delete: [116; 116),
kind: EnumVariant, insert: "Bar",
detail: "(i32)", kind: EnumVariant,
documentation: Documentation( detail: "(i32)",
"Bar Variant with i32", documentation: Documentation(
), "Bar Variant with i32",
}, ),
CompletionItem { },
label: "Foo", CompletionItem {
source_range: [116; 116), label: "Foo",
delete: [116; 116), source_range: [116; 116),
insert: "Foo", delete: [116; 116),
kind: EnumVariant, insert: "Foo",
detail: "()", kind: EnumVariant,
documentation: Documentation( detail: "()",
"Foo Variant", documentation: Documentation(
), "Foo Variant",
}, ),
]"### },
]
"###
); );
} }
@ -343,41 +355,43 @@ mod tests {
fn foo() { let _ = E::<|> } fn foo() { let _ = E::<|> }
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "Bar", CompletionItem {
source_range: [180; 180), label: "Bar",
delete: [180; 180), source_range: [180; 180),
insert: "Bar", delete: [180; 180),
kind: EnumVariant, insert: "Bar",
detail: "(i32, u32)", kind: EnumVariant,
documentation: Documentation( detail: "(i32, u32)",
"Bar Variant with i32 and u32", documentation: Documentation(
), "Bar Variant with i32 and u32",
}, ),
CompletionItem { },
label: "Foo", CompletionItem {
source_range: [180; 180), label: "Foo",
delete: [180; 180), source_range: [180; 180),
insert: "Foo", delete: [180; 180),
kind: EnumVariant, insert: "Foo",
detail: "()", kind: EnumVariant,
documentation: Documentation( detail: "()",
"Foo Variant (empty)", documentation: Documentation(
), "Foo Variant (empty)",
}, ),
CompletionItem { },
label: "S", CompletionItem {
source_range: [180; 180), label: "S",
delete: [180; 180), source_range: [180; 180),
insert: "S", delete: [180; 180),
kind: EnumVariant, insert: "S",
detail: "(S)", kind: EnumVariant,
documentation: Documentation( detail: "(S)",
"", documentation: Documentation(
), "",
}, ),
]"### },
]
"###
); );
} }
@ -434,19 +448,21 @@ mod tests {
fn foo() { let _ = S::<|> } fn foo() { let _ = S::<|> }
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "C", CompletionItem {
source_range: [107; 107), label: "C",
delete: [107; 107), source_range: [107; 107),
insert: "C", delete: [107; 107),
kind: Const, insert: "C",
detail: "const C: i32 = 42;", kind: Const,
documentation: Documentation( detail: "const C: i32 = 42;",
"An associated const", documentation: Documentation(
), "An associated const",
}, ),
]"### },
]
"###
); );
} }
@ -467,19 +483,21 @@ mod tests {
fn foo() { let _ = S::<|> } fn foo() { let _ = S::<|> }
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "T", CompletionItem {
source_range: [101; 101), label: "T",
delete: [101; 101), source_range: [101; 101),
insert: "T", delete: [101; 101),
kind: TypeAlias, insert: "T",
detail: "type T = i32;", kind: TypeAlias,
documentation: Documentation( detail: "type T = i32;",
"An associated type", documentation: Documentation(
), "An associated type",
}, ),
]"### },
]
"###
); );
} }
@ -569,15 +587,17 @@ mod tests {
} }
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "bar", CompletionItem {
source_range: [9; 9), label: "bar",
delete: [9; 9), source_range: [9; 9),
insert: "bar", delete: [9; 9),
kind: Module, insert: "bar",
}, kind: Module,
]"### },
]
"###
); );
} }

View file

@ -54,36 +54,36 @@ mod tests {
", ",
); );
assert_debug_snapshot!(completions, @r###" assert_debug_snapshot!(completions, @r###"
[ [
CompletionItem { CompletionItem {
label: "E", label: "E",
source_range: [246; 246), source_range: [246; 246),
delete: [246; 246), delete: [246; 246),
insert: "E", insert: "E",
kind: Enum, kind: Enum,
}, },
CompletionItem { CompletionItem {
label: "X", label: "X",
source_range: [246; 246), source_range: [246; 246),
delete: [246; 246), delete: [246; 246),
insert: "X", insert: "X",
kind: EnumVariant, kind: EnumVariant,
}, },
CompletionItem { CompletionItem {
label: "Z", label: "Z",
source_range: [246; 246), source_range: [246; 246),
delete: [246; 246), delete: [246; 246),
insert: "Z", insert: "Z",
kind: Const, kind: Const,
}, },
CompletionItem { CompletionItem {
label: "m", label: "m",
source_range: [246; 246), source_range: [246; 246),
delete: [246; 246), delete: [246; 246),
insert: "m", insert: "m",
kind: Module, kind: Module,
}, },
] ]
"###); "###);
} }
} }

View file

@ -104,64 +104,66 @@ mod tests {
} }
"#, "#,
), ),
@r###"[ @r###"
CompletionItem { [
label: "box", CompletionItem {
source_range: [89; 89), label: "box",
delete: [85; 89), source_range: [89; 89),
insert: "Box::new(bar)", delete: [85; 89),
detail: "Box::new(expr)", insert: "Box::new(bar)",
}, detail: "Box::new(expr)",
CompletionItem { },
label: "dbg", CompletionItem {
source_range: [89; 89), label: "dbg",
delete: [85; 89), source_range: [89; 89),
insert: "dbg!(bar)", delete: [85; 89),
detail: "dbg!(expr)", insert: "dbg!(bar)",
}, detail: "dbg!(expr)",
CompletionItem { },
label: "if", CompletionItem {
source_range: [89; 89), label: "if",
delete: [85; 89), source_range: [89; 89),
insert: "if bar {$0}", delete: [85; 89),
detail: "if expr {}", insert: "if bar {$0}",
}, detail: "if expr {}",
CompletionItem { },
label: "match", CompletionItem {
source_range: [89; 89), label: "match",
delete: [85; 89), source_range: [89; 89),
insert: "match bar {\n ${1:_} => {$0\\},\n}", delete: [85; 89),
detail: "match expr {}", insert: "match bar {\n ${1:_} => {$0\\},\n}",
}, detail: "match expr {}",
CompletionItem { },
label: "not", CompletionItem {
source_range: [89; 89), label: "not",
delete: [85; 89), source_range: [89; 89),
insert: "!bar", delete: [85; 89),
detail: "!expr", insert: "!bar",
}, detail: "!expr",
CompletionItem { },
label: "ref", CompletionItem {
source_range: [89; 89), label: "ref",
delete: [85; 89), source_range: [89; 89),
insert: "&bar", delete: [85; 89),
detail: "&expr", insert: "&bar",
}, detail: "&expr",
CompletionItem { },
label: "refm", CompletionItem {
source_range: [89; 89), label: "refm",
delete: [85; 89), source_range: [89; 89),
insert: "&mut bar", delete: [85; 89),
detail: "&mut expr", insert: "&mut bar",
}, detail: "&mut expr",
CompletionItem { },
label: "while", CompletionItem {
source_range: [89; 89), label: "while",
delete: [85; 89), source_range: [89; 89),
insert: "while bar {\n$0\n}", delete: [85; 89),
detail: "while expr {}", insert: "while bar {\n$0\n}",
}, detail: "while expr {}",
]"### },
]
"###
); );
} }
@ -176,50 +178,52 @@ mod tests {
} }
"#, "#,
), ),
@r###"[ @r###"
CompletionItem { [
label: "box", CompletionItem {
source_range: [91; 91), label: "box",
delete: [87; 91), source_range: [91; 91),
insert: "Box::new(bar)", delete: [87; 91),
detail: "Box::new(expr)", insert: "Box::new(bar)",
}, detail: "Box::new(expr)",
CompletionItem { },
label: "dbg", CompletionItem {
source_range: [91; 91), label: "dbg",
delete: [87; 91), source_range: [91; 91),
insert: "dbg!(bar)", delete: [87; 91),
detail: "dbg!(expr)", insert: "dbg!(bar)",
}, detail: "dbg!(expr)",
CompletionItem { },
label: "match", CompletionItem {
source_range: [91; 91), label: "match",
delete: [87; 91), source_range: [91; 91),
insert: "match bar {\n ${1:_} => {$0\\},\n}", delete: [87; 91),
detail: "match expr {}", insert: "match bar {\n ${1:_} => {$0\\},\n}",
}, detail: "match expr {}",
CompletionItem { },
label: "not", CompletionItem {
source_range: [91; 91), label: "not",
delete: [87; 91), source_range: [91; 91),
insert: "!bar", delete: [87; 91),
detail: "!expr", insert: "!bar",
}, detail: "!expr",
CompletionItem { },
label: "ref", CompletionItem {
source_range: [91; 91), label: "ref",
delete: [87; 91), source_range: [91; 91),
insert: "&bar", delete: [87; 91),
detail: "&expr", insert: "&bar",
}, detail: "&expr",
CompletionItem { },
label: "refm", CompletionItem {
source_range: [91; 91), label: "refm",
delete: [87; 91), source_range: [91; 91),
insert: "&mut bar", delete: [87; 91),
detail: "&mut expr", insert: "&mut bar",
}, detail: "&mut expr",
]"### },
]
"###
); );
} }
@ -233,50 +237,52 @@ mod tests {
} }
"#, "#,
), ),
@r###"[ @r###"
CompletionItem { [
label: "box", CompletionItem {
source_range: [52; 52), label: "box",
delete: [49; 52), source_range: [52; 52),
insert: "Box::new(42)", delete: [49; 52),
detail: "Box::new(expr)", insert: "Box::new(42)",
}, detail: "Box::new(expr)",
CompletionItem { },
label: "dbg", CompletionItem {
source_range: [52; 52), label: "dbg",
delete: [49; 52), source_range: [52; 52),
insert: "dbg!(42)", delete: [49; 52),
detail: "dbg!(expr)", insert: "dbg!(42)",
}, detail: "dbg!(expr)",
CompletionItem { },
label: "match", CompletionItem {
source_range: [52; 52), label: "match",
delete: [49; 52), source_range: [52; 52),
insert: "match 42 {\n ${1:_} => {$0\\},\n}", delete: [49; 52),
detail: "match expr {}", insert: "match 42 {\n ${1:_} => {$0\\},\n}",
}, detail: "match expr {}",
CompletionItem { },
label: "not", CompletionItem {
source_range: [52; 52), label: "not",
delete: [49; 52), source_range: [52; 52),
insert: "!42", delete: [49; 52),
detail: "!expr", insert: "!42",
}, detail: "!expr",
CompletionItem { },
label: "ref", CompletionItem {
source_range: [52; 52), label: "ref",
delete: [49; 52), source_range: [52; 52),
insert: "&42", delete: [49; 52),
detail: "&expr", insert: "&42",
}, detail: "&expr",
CompletionItem { },
label: "refm", CompletionItem {
source_range: [52; 52), label: "refm",
delete: [49; 52), source_range: [52; 52),
insert: "&mut 42", delete: [49; 52),
detail: "&mut expr", insert: "&mut 42",
}, detail: "&mut expr",
]"### },
]
"###
); );
} }
} }

View file

@ -45,17 +45,17 @@ mod tests {
", ",
); );
assert_debug_snapshot!(completions, @r###" assert_debug_snapshot!(completions, @r###"
[ [
CompletionItem { CompletionItem {
label: "the_field", label: "the_field",
source_range: [142; 145), source_range: [142; 145),
delete: [142; 145), delete: [142; 145),
insert: "the_field", insert: "the_field",
kind: Field, kind: Field,
detail: "u32", detail: "u32",
deprecated: true, deprecated: true,
}, },
] ]
"###); "###);
} }
@ -70,16 +70,16 @@ mod tests {
", ",
); );
assert_debug_snapshot!(completions, @r###" assert_debug_snapshot!(completions, @r###"
[ [
CompletionItem { CompletionItem {
label: "the_field", label: "the_field",
source_range: [83; 86), source_range: [83; 86),
delete: [83; 86), delete: [83; 86),
insert: "the_field", insert: "the_field",
kind: Field, kind: Field,
detail: "u32", detail: "u32",
}, },
] ]
"###); "###);
} }
@ -96,16 +96,16 @@ mod tests {
", ",
); );
assert_debug_snapshot!(completions, @r###" assert_debug_snapshot!(completions, @r###"
[ [
CompletionItem { CompletionItem {
label: "a", label: "a",
source_range: [119; 119), source_range: [119; 119),
delete: [119; 119), delete: [119; 119),
insert: "a", insert: "a",
kind: Field, kind: Field,
detail: "u32", detail: "u32",
}, },
] ]
"###); "###);
} }
@ -122,16 +122,16 @@ mod tests {
", ",
); );
assert_debug_snapshot!(completions, @r###" assert_debug_snapshot!(completions, @r###"
[ [
CompletionItem { CompletionItem {
label: "b", label: "b",
source_range: [119; 119), source_range: [119; 119),
delete: [119; 119), delete: [119; 119),
insert: "b", insert: "b",
kind: Field, kind: Field,
detail: "u32", detail: "u32",
}, },
] ]
"###); "###);
} }
@ -147,16 +147,16 @@ mod tests {
", ",
); );
assert_debug_snapshot!(completions, @r###" assert_debug_snapshot!(completions, @r###"
[ [
CompletionItem { CompletionItem {
label: "a", label: "a",
source_range: [93; 93), source_range: [93; 93),
delete: [93; 93), delete: [93; 93),
insert: "a", insert: "a",
kind: Field, kind: Field,
detail: "u32", detail: "u32",
}, },
] ]
"###); "###);
} }
} }

View file

@ -44,16 +44,16 @@ mod tests {
", ",
); );
assert_debug_snapshot!(completions, @r###" assert_debug_snapshot!(completions, @r###"
[ [
CompletionItem { CompletionItem {
label: "foo", label: "foo",
source_range: [117; 118), source_range: [117; 118),
delete: [117; 118), delete: [117; 118),
insert: "foo", insert: "foo",
kind: Field, kind: Field,
detail: "u32", detail: "u32",
}, },
] ]
"###); "###);
} }
@ -73,24 +73,24 @@ mod tests {
", ",
); );
assert_debug_snapshot!(completions, @r###" assert_debug_snapshot!(completions, @r###"
[ [
CompletionItem { CompletionItem {
label: "bar", label: "bar",
source_range: [161; 161), source_range: [161; 161),
delete: [161; 161), delete: [161; 161),
insert: "bar", insert: "bar",
kind: Field, kind: Field,
detail: "()", detail: "()",
}, },
CompletionItem { CompletionItem {
label: "foo", label: "foo",
source_range: [161; 161), source_range: [161; 161),
delete: [161; 161), delete: [161; 161),
insert: "foo", insert: "foo",
kind: Field, kind: Field,
detail: "u32", detail: "u32",
}, },
] ]
"###); "###);
} }
} }

View file

@ -409,15 +409,17 @@ mod tests {
// nothing here // nothing here
" "
), ),
@r#"[ @r###"
CompletionItem { [
label: "other_crate", CompletionItem {
source_range: [4; 4), label: "other_crate",
delete: [4; 4), source_range: [4; 4),
insert: "other_crate", delete: [4; 4),
kind: Module, insert: "other_crate",
}, kind: Module,
]"# },
]
"###
); );
} }
@ -530,23 +532,25 @@ mod tests {
fn completes_self_in_methods() { fn completes_self_in_methods() {
assert_debug_snapshot!( assert_debug_snapshot!(
do_reference_completion(r"impl S { fn foo(&self) { <|> } }"), do_reference_completion(r"impl S { fn foo(&self) { <|> } }"),
@r#"[ @r###"
CompletionItem { [
label: "Self", CompletionItem {
source_range: [25; 25), label: "Self",
delete: [25; 25), source_range: [25; 25),
insert: "Self", delete: [25; 25),
kind: TypeParam, insert: "Self",
}, kind: TypeParam,
CompletionItem { },
label: "self", CompletionItem {
source_range: [25; 25), label: "self",
delete: [25; 25), source_range: [25; 25),
insert: "self", delete: [25; 25),
kind: Binding, insert: "self",
detail: "&{unknown}", kind: Binding,
}, detail: "&{unknown}",
]"# },
]
"###
); );
} }

View file

@ -52,22 +52,24 @@ mod tests {
fn completes_snippets_in_expressions() { fn completes_snippets_in_expressions() {
assert_debug_snapshot!( assert_debug_snapshot!(
do_snippet_completion(r"fn foo(x: i32) { <|> }"), do_snippet_completion(r"fn foo(x: i32) { <|> }"),
@r#"[ @r###"
CompletionItem { [
label: "pd", CompletionItem {
source_range: [17; 17), label: "pd",
delete: [17; 17), source_range: [17; 17),
insert: "eprintln!(\"$0 = {:?}\", $0);", delete: [17; 17),
kind: Snippet, insert: "eprintln!(\"$0 = {:?}\", $0);",
}, kind: Snippet,
CompletionItem { },
label: "ppd", CompletionItem {
source_range: [17; 17), label: "ppd",
delete: [17; 17), source_range: [17; 17),
insert: "eprintln!(\"$0 = {:#?}\", $0);", delete: [17; 17),
kind: Snippet, insert: "eprintln!(\"$0 = {:#?}\", $0);",
}, kind: Snippet,
]"# },
]
"###
); );
} }
@ -75,11 +77,11 @@ mod tests {
fn should_not_complete_snippets_in_path() { fn should_not_complete_snippets_in_path() {
assert_debug_snapshot!( assert_debug_snapshot!(
do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"), do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"),
@r#"[]"# @"[]"
); );
assert_debug_snapshot!( assert_debug_snapshot!(
do_snippet_completion(r"fn foo(x: i32) { ::<|> }"), do_snippet_completion(r"fn foo(x: i32) { ::<|> }"),
@r#"[]"# @"[]"
); );
} }
@ -94,23 +96,25 @@ mod tests {
} }
" "
), ),
@r###"[ @r###"
CompletionItem { [
label: "Test function", CompletionItem {
source_range: [78; 78), label: "Test function",
delete: [78; 78), source_range: [78; 78),
insert: "#[test]\nfn ${1:feature}() {\n $0\n}", delete: [78; 78),
kind: Snippet, insert: "#[test]\nfn ${1:feature}() {\n $0\n}",
lookup: "tfn", kind: Snippet,
}, lookup: "tfn",
CompletionItem { },
label: "pub(crate)", CompletionItem {
source_range: [78; 78), label: "pub(crate)",
delete: [78; 78), source_range: [78; 78),
insert: "pub(crate) $0", delete: [78; 78),
kind: Snippet, insert: "pub(crate) $0",
}, kind: Snippet,
]"### },
]
"###
); );
} }
} }

View file

@ -323,38 +323,38 @@ mod tests {
"#, "#,
), ),
@r###" @r###"
[ [
CompletionItem { CompletionItem {
label: "main()", label: "main()",
source_range: [203; 206), source_range: [203; 206),
delete: [203; 206), delete: [203; 206),
insert: "main()$0", insert: "main()$0",
kind: Function, kind: Function,
lookup: "main", lookup: "main",
detail: "fn main()", detail: "fn main()",
}, },
CompletionItem { CompletionItem {
label: "something_deprecated()", label: "something_deprecated()",
source_range: [203; 206), source_range: [203; 206),
delete: [203; 206), delete: [203; 206),
insert: "something_deprecated()$0", insert: "something_deprecated()$0",
kind: Function, kind: Function,
lookup: "something_deprecated", lookup: "something_deprecated",
detail: "fn something_deprecated()", detail: "fn something_deprecated()",
deprecated: true, deprecated: true,
}, },
CompletionItem { CompletionItem {
label: "something_else_deprecated()", label: "something_else_deprecated()",
source_range: [203; 206), source_range: [203; 206),
delete: [203; 206), delete: [203; 206),
insert: "something_else_deprecated()$0", insert: "something_else_deprecated()$0",
kind: Function, kind: Function,
lookup: "something_else_deprecated", lookup: "something_else_deprecated",
detail: "fn something_else_deprecated()", detail: "fn something_else_deprecated()",
deprecated: true, deprecated: true,
}, },
] ]
"### "###
); );
} }
@ -459,16 +459,18 @@ mod tests {
use crate::m::f<|>; use crate::m::f<|>;
" "
), ),
@r#"[ @r###"
CompletionItem { [
label: "foo", CompletionItem {
source_range: [40; 41), label: "foo",
delete: [40; 41), source_range: [40; 41),
insert: "foo", delete: [40; 41),
kind: Function, insert: "foo",
detail: "pub fn foo()", kind: Function,
}, detail: "pub fn foo()",
]"# },
]
"###
); );
} }
@ -484,24 +486,26 @@ mod tests {
} }
" "
), ),
@r#"[ @r###"
CompletionItem { [
label: "frobnicate", CompletionItem {
source_range: [35; 39), label: "frobnicate",
delete: [35; 39), source_range: [35; 39),
insert: "frobnicate", delete: [35; 39),
kind: Function, insert: "frobnicate",
detail: "fn frobnicate()", kind: Function,
}, detail: "fn frobnicate()",
CompletionItem { },
label: "main", CompletionItem {
source_range: [35; 39), label: "main",
delete: [35; 39), source_range: [35; 39),
insert: "main", delete: [35; 39),
kind: Function, insert: "main",
detail: "fn main()", kind: Function,
}, detail: "fn main()",
]"# },
]
"###
); );
assert_debug_snapshot!( assert_debug_snapshot!(
do_reference_completion( do_reference_completion(
@ -514,16 +518,18 @@ mod tests {
} }
" "
), ),
@r#"[ @r###"
CompletionItem { [
label: "new", CompletionItem {
source_range: [67; 69), label: "new",
delete: [67; 69), source_range: [67; 69),
insert: "new", delete: [67; 69),
kind: Function, insert: "new",
detail: "fn new() -> Foo", kind: Function,
}, detail: "fn new() -> Foo",
]"# },
]
"###
); );
} }

View file

@ -526,28 +526,28 @@ mod tests {
let (analysis, file_id) = single_file("mod foo;"); let (analysis, file_id) = single_file("mod foo;");
let diagnostics = analysis.diagnostics(file_id).unwrap(); let diagnostics = analysis.diagnostics(file_id).unwrap();
assert_debug_snapshot!(diagnostics, @r###" assert_debug_snapshot!(diagnostics, @r###"
[ [
Diagnostic { Diagnostic {
message: "unresolved module", message: "unresolved module",
range: [0; 8), range: [0; 8),
fix: Some( fix: Some(
SourceChange { SourceChange {
label: "create module", label: "create module",
source_file_edits: [], source_file_edits: [],
file_system_edits: [ file_system_edits: [
CreateFile { CreateFile {
source_root: SourceRootId( source_root: SourceRootId(
0, 0,
), ),
path: "foo.rs", path: "foo.rs",
}, },
], ],
cursor_position: None, cursor_position: None,
}, },
), ),
severity: Error, severity: Error,
}, },
] ]
"###); "###);
} }

View file

@ -209,191 +209,193 @@ fn very_obsolete() {}
.unwrap(); .unwrap();
let structure = file_structure(&file); let structure = file_structure(&file);
assert_debug_snapshot!(structure, assert_debug_snapshot!(structure,
@r#"[ @r###"
StructureNode { [
parent: None, StructureNode {
label: "Foo", parent: None,
navigation_range: [8; 11), label: "Foo",
node_range: [1; 26), navigation_range: [8; 11),
kind: STRUCT_DEF, node_range: [1; 26),
detail: None, kind: STRUCT_DEF,
deprecated: false, detail: None,
}, deprecated: false,
StructureNode { },
parent: Some( StructureNode {
0, parent: Some(
), 0,
label: "x", ),
navigation_range: [18; 19), label: "x",
node_range: [18; 24), navigation_range: [18; 19),
kind: RECORD_FIELD_DEF, node_range: [18; 24),
detail: Some( kind: RECORD_FIELD_DEF,
"i32", detail: Some(
), "i32",
deprecated: false, ),
}, deprecated: false,
StructureNode { },
parent: None, StructureNode {
label: "m", parent: None,
navigation_range: [32; 33), label: "m",
node_range: [28; 158), navigation_range: [32; 33),
kind: MODULE, node_range: [28; 158),
detail: None, kind: MODULE,
deprecated: false, detail: None,
}, deprecated: false,
StructureNode { },
parent: Some( StructureNode {
2, parent: Some(
), 2,
label: "bar1", ),
navigation_range: [43; 47), label: "bar1",
node_range: [40; 52), navigation_range: [43; 47),
kind: FN_DEF, node_range: [40; 52),
detail: Some( kind: FN_DEF,
"fn()", detail: Some(
), "fn()",
deprecated: false, ),
}, deprecated: false,
StructureNode { },
parent: Some( StructureNode {
2, parent: Some(
), 2,
label: "bar2", ),
navigation_range: [60; 64), label: "bar2",
node_range: [57; 81), navigation_range: [60; 64),
kind: FN_DEF, node_range: [57; 81),
detail: Some( kind: FN_DEF,
"fn<T>(t: T) -> T", detail: Some(
), "fn<T>(t: T) -> T",
deprecated: false, ),
}, deprecated: false,
StructureNode { },
parent: Some( StructureNode {
2, parent: Some(
), 2,
label: "bar3", ),
navigation_range: [89; 93), label: "bar3",
node_range: [86; 156), navigation_range: [89; 93),
kind: FN_DEF, node_range: [86; 156),
detail: Some( kind: FN_DEF,
"fn<A, B>(a: A, b: B) -> Vec< u32 >", detail: Some(
), "fn<A, B>(a: A, b: B) -> Vec< u32 >",
deprecated: false, ),
}, deprecated: false,
StructureNode { },
parent: None, StructureNode {
label: "E", parent: None,
navigation_range: [165; 166), label: "E",
node_range: [160; 180), navigation_range: [165; 166),
kind: ENUM_DEF, node_range: [160; 180),
detail: None, kind: ENUM_DEF,
deprecated: false, detail: None,
}, deprecated: false,
StructureNode { },
parent: Some( StructureNode {
6, parent: Some(
), 6,
label: "X", ),
navigation_range: [169; 170), label: "X",
node_range: [169; 170), navigation_range: [169; 170),
kind: ENUM_VARIANT, node_range: [169; 170),
detail: None, kind: ENUM_VARIANT,
deprecated: false, detail: None,
}, deprecated: false,
StructureNode { },
parent: Some( StructureNode {
6, parent: Some(
), 6,
label: "Y", ),
navigation_range: [172; 173), label: "Y",
node_range: [172; 178), navigation_range: [172; 173),
kind: ENUM_VARIANT, node_range: [172; 178),
detail: None, kind: ENUM_VARIANT,
deprecated: false, detail: None,
}, deprecated: false,
StructureNode { },
parent: None, StructureNode {
label: "T", parent: None,
navigation_range: [186; 187), label: "T",
node_range: [181; 193), navigation_range: [186; 187),
kind: TYPE_ALIAS_DEF, node_range: [181; 193),
detail: Some( kind: TYPE_ALIAS_DEF,
"()", detail: Some(
), "()",
deprecated: false, ),
}, deprecated: false,
StructureNode { },
parent: None, StructureNode {
label: "S", parent: None,
navigation_range: [201; 202), label: "S",
node_range: [194; 213), navigation_range: [201; 202),
kind: STATIC_DEF, node_range: [194; 213),
detail: Some( kind: STATIC_DEF,
"i32", detail: Some(
), "i32",
deprecated: false, ),
}, deprecated: false,
StructureNode { },
parent: None, StructureNode {
label: "C", parent: None,
navigation_range: [220; 221), label: "C",
node_range: [214; 232), navigation_range: [220; 221),
kind: CONST_DEF, node_range: [214; 232),
detail: Some( kind: CONST_DEF,
"i32", detail: Some(
), "i32",
deprecated: false, ),
}, deprecated: false,
StructureNode { },
parent: None, StructureNode {
label: "impl E", parent: None,
navigation_range: [239; 240), label: "impl E",
node_range: [234; 243), navigation_range: [239; 240),
kind: IMPL_BLOCK, node_range: [234; 243),
detail: None, kind: IMPL_BLOCK,
deprecated: false, detail: None,
}, deprecated: false,
StructureNode { },
parent: None, StructureNode {
label: "impl fmt::Debug for E", parent: None,
navigation_range: [265; 266), label: "impl fmt::Debug for E",
node_range: [245; 269), navigation_range: [265; 266),
kind: IMPL_BLOCK, node_range: [245; 269),
detail: None, kind: IMPL_BLOCK,
deprecated: false, detail: None,
}, deprecated: false,
StructureNode { },
parent: None, StructureNode {
label: "mc", parent: None,
navigation_range: [284; 286), label: "mc",
node_range: [271; 303), navigation_range: [284; 286),
kind: MACRO_CALL, node_range: [271; 303),
detail: None, kind: MACRO_CALL,
deprecated: false, detail: None,
}, deprecated: false,
StructureNode { },
parent: None, StructureNode {
label: "obsolete", parent: None,
navigation_range: [322; 330), label: "obsolete",
node_range: [305; 335), navigation_range: [322; 330),
kind: FN_DEF, node_range: [305; 335),
detail: Some( kind: FN_DEF,
"fn()", detail: Some(
), "fn()",
deprecated: true, ),
}, deprecated: true,
StructureNode { },
parent: None, StructureNode {
label: "very_obsolete", parent: None,
navigation_range: [375; 388), label: "very_obsolete",
node_range: [337; 393), navigation_range: [375; 388),
kind: FN_DEF, node_range: [337; 393),
detail: Some( kind: FN_DEF,
"fn()", detail: Some(
), "fn()",
deprecated: true, ),
}, deprecated: true,
]"# },
]
"###
); );
} }
} }

View file

@ -214,58 +214,60 @@ fn main() {
}"#, }"#,
); );
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###"
InlayHint { [
range: [193; 197), InlayHint {
kind: TypeHint, range: [193; 197),
label: "i32", kind: TypeHint,
}, label: "i32",
InlayHint { },
range: [236; 244), InlayHint {
kind: TypeHint, range: [236; 244),
label: "i32", kind: TypeHint,
}, label: "i32",
InlayHint { },
range: [275; 279), InlayHint {
kind: TypeHint, range: [275; 279),
label: "&str", kind: TypeHint,
}, label: "&str",
InlayHint { },
range: [539; 543), InlayHint {
kind: TypeHint, range: [539; 543),
label: "(i32, char)", kind: TypeHint,
}, label: "(i32, char)",
InlayHint { },
range: [566; 567), InlayHint {
kind: TypeHint, range: [566; 567),
label: "i32", kind: TypeHint,
}, label: "i32",
InlayHint { },
range: [570; 571), InlayHint {
kind: TypeHint, range: [570; 571),
label: "i32", kind: TypeHint,
}, label: "i32",
InlayHint { },
range: [573; 574), InlayHint {
kind: TypeHint, range: [573; 574),
label: "i32", kind: TypeHint,
}, label: "i32",
InlayHint { },
range: [584; 585), InlayHint {
kind: TypeHint, range: [584; 585),
label: "i32", kind: TypeHint,
}, label: "i32",
InlayHint { },
range: [577; 578), InlayHint {
kind: TypeHint, range: [577; 578),
label: "f64", kind: TypeHint,
}, label: "f64",
InlayHint { },
range: [580; 581), InlayHint {
kind: TypeHint, range: [580; 581),
label: "f64", kind: TypeHint,
}, label: "f64",
]"# },
]
"###
); );
} }
@ -281,18 +283,20 @@ fn main() {
}"#, }"#,
); );
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###"
InlayHint { [
range: [21; 30), InlayHint {
kind: TypeHint, range: [21; 30),
label: "i32", kind: TypeHint,
}, label: "i32",
InlayHint { },
range: [57; 66), InlayHint {
kind: TypeHint, range: [57; 66),
label: "i32", kind: TypeHint,
}, label: "i32",
]"# },
]
"###
); );
} }
@ -308,18 +312,20 @@ fn main() {
}"#, }"#,
); );
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###"
InlayHint { [
range: [21; 30), InlayHint {
kind: TypeHint, range: [21; 30),
label: "i32", kind: TypeHint,
}, label: "i32",
InlayHint { },
range: [44; 53), InlayHint {
kind: TypeHint, range: [44; 53),
label: "i32", kind: TypeHint,
}, label: "i32",
]"# },
]
"###
); );
} }
@ -354,33 +360,35 @@ fn main() {
}"#, }"#,
); );
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###"
InlayHint { [
range: [166; 170), InlayHint {
kind: TypeHint, range: [166; 170),
label: "CustomOption<Test>", kind: TypeHint,
}, label: "CustomOption<Test>",
InlayHint { },
range: [334; 338), InlayHint {
kind: TypeHint, range: [334; 338),
label: "&Test", kind: TypeHint,
}, label: "&Test",
InlayHint { },
range: [389; 390), InlayHint {
kind: TypeHint, range: [389; 390),
label: "&CustomOption<u32>", kind: TypeHint,
}, label: "&CustomOption<u32>",
InlayHint { },
range: [392; 393), InlayHint {
kind: TypeHint, range: [392; 393),
label: "&u8", kind: TypeHint,
}, label: "&u8",
InlayHint { },
range: [531; 532), InlayHint {
kind: TypeHint, range: [531; 532),
label: "&u32", kind: TypeHint,
}, label: "&u32",
]"# },
]
"###
); );
} }
@ -416,33 +424,33 @@ fn main() {
); );
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###" assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###"
[ [
InlayHint { InlayHint {
range: [166; 170), range: [166; 170),
kind: TypeHint, kind: TypeHint,
label: "CustomOption<Test>", label: "CustomOption<Test>",
}, },
InlayHint { InlayHint {
range: [343; 347), range: [343; 347),
kind: TypeHint, kind: TypeHint,
label: "&Test", label: "&Test",
}, },
InlayHint { InlayHint {
range: [401; 402), range: [401; 402),
kind: TypeHint, kind: TypeHint,
label: "&CustomOption<u32>", label: "&CustomOption<u32>",
}, },
InlayHint { InlayHint {
range: [404; 405), range: [404; 405),
kind: TypeHint, kind: TypeHint,
label: "&u8", label: "&u8",
}, },
InlayHint { InlayHint {
range: [549; 550), range: [549; 550),
kind: TypeHint, kind: TypeHint,
label: "&u32", label: "&u32",
}, },
] ]
"### "###
); );
} }
@ -478,28 +486,30 @@ fn main() {
}"#, }"#,
); );
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###"
InlayHint { [
range: [311; 315), InlayHint {
kind: TypeHint, range: [311; 315),
label: "Test", kind: TypeHint,
}, label: "Test",
InlayHint { },
range: [358; 359), InlayHint {
kind: TypeHint, range: [358; 359),
label: "CustomOption<u32>", kind: TypeHint,
}, label: "CustomOption<u32>",
InlayHint { },
range: [361; 362), InlayHint {
kind: TypeHint, range: [361; 362),
label: "u8", kind: TypeHint,
}, label: "u8",
InlayHint { },
range: [484; 485), InlayHint {
kind: TypeHint, range: [484; 485),
label: "u32", kind: TypeHint,
}, label: "u32",
]"# },
]
"###
); );
} }
} }

View file

@ -97,24 +97,26 @@ mod tests {
); );
let runnables = analysis.runnables(pos.file_id).unwrap(); let runnables = analysis.runnables(pos.file_id).unwrap();
assert_debug_snapshot!(&runnables, assert_debug_snapshot!(&runnables,
@r#"[ @r###"
Runnable { [
range: [1; 21), Runnable {
kind: Bin, range: [1; 21),
}, kind: Bin,
Runnable { },
range: [22; 46), Runnable {
kind: Test { range: [22; 46),
name: "test_foo", kind: Test {
}, name: "test_foo",
}, },
Runnable { },
range: [47; 81), Runnable {
kind: Test { range: [47; 81),
name: "test_foo", kind: Test {
}, name: "test_foo",
}, },
]"# },
]
"###
); );
} }
@ -132,20 +134,22 @@ mod tests {
); );
let runnables = analysis.runnables(pos.file_id).unwrap(); let runnables = analysis.runnables(pos.file_id).unwrap();
assert_debug_snapshot!(&runnables, assert_debug_snapshot!(&runnables,
@r#"[ @r###"
Runnable { [
range: [1; 59), Runnable {
kind: TestMod { range: [1; 59),
path: "test_mod", kind: TestMod {
}, path: "test_mod",
}, },
Runnable { },
range: [28; 57), Runnable {
kind: Test { range: [28; 57),
name: "test_foo1", kind: Test {
}, name: "test_foo1",
}, },
]"# },
]
"###
); );
} }
@ -165,20 +169,22 @@ mod tests {
); );
let runnables = analysis.runnables(pos.file_id).unwrap(); let runnables = analysis.runnables(pos.file_id).unwrap();
assert_debug_snapshot!(&runnables, assert_debug_snapshot!(&runnables,
@r#"[ @r###"
Runnable { [
range: [23; 85), Runnable {
kind: TestMod { range: [23; 85),
path: "foo::test_mod", kind: TestMod {
}, path: "foo::test_mod",
}, },
Runnable { },
range: [46; 79), Runnable {
kind: Test { range: [46; 79),
name: "test_foo1", kind: Test {
}, name: "test_foo1",
}, },
]"# },
]
"###
); );
} }
@ -200,20 +206,22 @@ mod tests {
); );
let runnables = analysis.runnables(pos.file_id).unwrap(); let runnables = analysis.runnables(pos.file_id).unwrap();
assert_debug_snapshot!(&runnables, assert_debug_snapshot!(&runnables,
@r#"[ @r###"
Runnable { [
range: [41; 115), Runnable {
kind: TestMod { range: [41; 115),
path: "foo::bar::test_mod", kind: TestMod {
}, path: "foo::bar::test_mod",
}, },
Runnable { },
range: [68; 105), Runnable {
kind: Test { range: [68; 105),
name: "test_foo1", kind: Test {
}, name: "test_foo1",
}, },
]"# },
]
"###
); );
} }