mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
Standard formatting for array types
This commit is contained in:
parent
82ffe597ca
commit
6ca19b2188
5 changed files with 89 additions and 89 deletions
|
@ -847,7 +847,7 @@ impl HirDisplay for ApplicationTy {
|
|||
}
|
||||
TypeCtor::Array => {
|
||||
let t = self.parameters.as_single();
|
||||
write!(f, "[{};_]", t.display(f.db))?;
|
||||
write!(f, "[{}; _]", t.display(f.db))?;
|
||||
}
|
||||
TypeCtor::RawPtr(m) => {
|
||||
let t = self.parameters.as_single();
|
||||
|
|
|
@ -71,42 +71,42 @@ fn test2() {
|
|||
[82; 93) '{ loop {} }': T
|
||||
[84; 91) 'loop {}': !
|
||||
[89; 91) '{}': ()
|
||||
[122; 133) '{ loop {} }': *mut [T;_]
|
||||
[122; 133) '{ loop {} }': *mut [T; _]
|
||||
[124; 131) 'loop {}': !
|
||||
[129; 131) '{}': ()
|
||||
[160; 173) '{ gen() }': *mut [U]
|
||||
[166; 169) 'gen': fn gen<U>() -> *mut [T;_]
|
||||
[166; 171) 'gen()': *mut [U;_]
|
||||
[166; 169) 'gen': fn gen<U>() -> *mut [T; _]
|
||||
[166; 171) 'gen()': *mut [U; _]
|
||||
[186; 420) '{ ...rr); }': ()
|
||||
[196; 199) 'arr': &[u8;_]
|
||||
[212; 216) '&[1]': &[u8;_]
|
||||
[213; 216) '[1]': [u8;_]
|
||||
[196; 199) 'arr': &[u8; _]
|
||||
[212; 216) '&[1]': &[u8; _]
|
||||
[213; 216) '[1]': [u8; _]
|
||||
[214; 215) '1': u8
|
||||
[227; 228) 'a': &[u8]
|
||||
[237; 240) 'arr': &[u8;_]
|
||||
[237; 240) 'arr': &[u8; _]
|
||||
[250; 251) 'b': u8
|
||||
[254; 255) 'f': fn f<u8>(&[T]) -> T
|
||||
[254; 260) 'f(arr)': u8
|
||||
[256; 259) 'arr': &[u8;_]
|
||||
[256; 259) 'arr': &[u8; _]
|
||||
[270; 271) 'c': &[u8]
|
||||
[280; 287) '{ arr }': &[u8]
|
||||
[282; 285) 'arr': &[u8;_]
|
||||
[282; 285) 'arr': &[u8; _]
|
||||
[297; 298) 'd': u8
|
||||
[301; 302) 'g': fn g<u8>(S<&[T]>) -> T
|
||||
[301; 316) 'g(S { a: arr })': u8
|
||||
[303; 315) 'S { a: arr }': S<&[u8]>
|
||||
[310; 313) 'arr': &[u8;_]
|
||||
[326; 327) 'e': [&[u8];_]
|
||||
[341; 346) '[arr]': [&[u8];_]
|
||||
[342; 345) 'arr': &[u8;_]
|
||||
[356; 357) 'f': [&[u8];_]
|
||||
[371; 379) '[arr; 2]': [&[u8];_]
|
||||
[372; 375) 'arr': &[u8;_]
|
||||
[310; 313) 'arr': &[u8; _]
|
||||
[326; 327) 'e': [&[u8]; _]
|
||||
[341; 346) '[arr]': [&[u8]; _]
|
||||
[342; 345) 'arr': &[u8; _]
|
||||
[356; 357) 'f': [&[u8]; _]
|
||||
[371; 379) '[arr; 2]': [&[u8]; _]
|
||||
[372; 375) 'arr': &[u8; _]
|
||||
[377; 378) '2': usize
|
||||
[389; 390) 'g': (&[u8], &[u8])
|
||||
[407; 417) '(arr, arr)': (&[u8], &[u8])
|
||||
[408; 411) 'arr': &[u8;_]
|
||||
[413; 416) 'arr': &[u8;_]
|
||||
[408; 411) 'arr': &[u8; _]
|
||||
[413; 416) 'arr': &[u8; _]
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ fn test() {
|
|||
@r###"
|
||||
[11; 40) '{ ...[1]; }': ()
|
||||
[21; 22) 'x': &[i32]
|
||||
[33; 37) '&[1]': &[i32;_]
|
||||
[34; 37) '[1]': [i32;_]
|
||||
[33; 37) '&[1]': &[i32; _]
|
||||
[34; 37) '[1]': [i32; _]
|
||||
[35; 36) '1': i32
|
||||
"###);
|
||||
}
|
||||
|
@ -159,22 +159,22 @@ fn test(a: A<[u8; 2]>, b: B<[u8; 2]>, c: C<[u8; 2]>) {
|
|||
[334; 335) 'x': C<[T]>
|
||||
[355; 360) '{ x }': C<[T]>
|
||||
[357; 358) 'x': C<[T]>
|
||||
[370; 371) 'a': A<[u8;_]>
|
||||
[385; 386) 'b': B<[u8;_]>
|
||||
[400; 401) 'c': C<[u8;_]>
|
||||
[370; 371) 'a': A<[u8; _]>
|
||||
[385; 386) 'b': B<[u8; _]>
|
||||
[400; 401) 'c': C<[u8; _]>
|
||||
[415; 481) '{ ...(c); }': ()
|
||||
[425; 426) 'd': A<[{unknown}]>
|
||||
[429; 433) 'foo1': fn foo1<{unknown}>(A<[T]>) -> A<[T]>
|
||||
[429; 436) 'foo1(a)': A<[{unknown}]>
|
||||
[434; 435) 'a': A<[u8;_]>
|
||||
[434; 435) 'a': A<[u8; _]>
|
||||
[446; 447) 'e': B<[u8]>
|
||||
[450; 454) 'foo2': fn foo2<u8>(B<[T]>) -> B<[T]>
|
||||
[450; 457) 'foo2(b)': B<[u8]>
|
||||
[455; 456) 'b': B<[u8;_]>
|
||||
[455; 456) 'b': B<[u8; _]>
|
||||
[467; 468) 'f': C<[u8]>
|
||||
[471; 475) 'foo3': fn foo3<u8>(C<[T]>) -> C<[T]>
|
||||
[471; 478) 'foo3(c)': C<[u8]>
|
||||
[476; 477) 'c': C<[u8;_]>
|
||||
[476; 477) 'c': C<[u8; _]>
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
@ -204,12 +204,12 @@ fn test() {
|
|||
[72; 97) '{ ... }': &[i32]
|
||||
[82; 85) 'foo': fn foo<i32>(&[T]) -> &[T]
|
||||
[82; 91) 'foo(&[1])': &[i32]
|
||||
[86; 90) '&[1]': &[i32;_]
|
||||
[87; 90) '[1]': [i32;_]
|
||||
[86; 90) '&[1]': &[i32; _]
|
||||
[87; 90) '[1]': [i32; _]
|
||||
[88; 89) '1': i32
|
||||
[103; 123) '{ ... }': &[i32;_]
|
||||
[113; 117) '&[1]': &[i32;_]
|
||||
[114; 117) '[1]': [i32;_]
|
||||
[103; 123) '{ ... }': &[i32; _]
|
||||
[113; 117) '&[1]': &[i32; _]
|
||||
[114; 117) '[1]': [i32; _]
|
||||
[115; 116) '1': i32
|
||||
"###
|
||||
);
|
||||
|
@ -237,15 +237,15 @@ fn test() {
|
|||
[60; 61) 'x': &[i32]
|
||||
[64; 123) 'if tru... }': &[i32]
|
||||
[67; 71) 'true': bool
|
||||
[72; 92) '{ ... }': &[i32;_]
|
||||
[82; 86) '&[1]': &[i32;_]
|
||||
[83; 86) '[1]': [i32;_]
|
||||
[72; 92) '{ ... }': &[i32; _]
|
||||
[82; 86) '&[1]': &[i32; _]
|
||||
[83; 86) '[1]': [i32; _]
|
||||
[84; 85) '1': i32
|
||||
[98; 123) '{ ... }': &[i32]
|
||||
[108; 111) 'foo': fn foo<i32>(&[T]) -> &[T]
|
||||
[108; 117) 'foo(&[1])': &[i32]
|
||||
[112; 116) '&[1]': &[i32;_]
|
||||
[113; 116) '[1]': [i32;_]
|
||||
[112; 116) '&[1]': &[i32; _]
|
||||
[113; 116) '[1]': [i32; _]
|
||||
[114; 115) '1': i32
|
||||
"###
|
||||
);
|
||||
|
@ -277,16 +277,16 @@ fn test(i: i32) {
|
|||
[88; 89) '2': i32
|
||||
[93; 96) 'foo': fn foo<i32>(&[T]) -> &[T]
|
||||
[93; 102) 'foo(&[2])': &[i32]
|
||||
[97; 101) '&[2]': &[i32;_]
|
||||
[98; 101) '[2]': [i32;_]
|
||||
[97; 101) '&[2]': &[i32; _]
|
||||
[98; 101) '[2]': [i32; _]
|
||||
[99; 100) '2': i32
|
||||
[112; 113) '1': i32
|
||||
[117; 121) '&[1]': &[i32;_]
|
||||
[118; 121) '[1]': [i32;_]
|
||||
[117; 121) '&[1]': &[i32; _]
|
||||
[118; 121) '[1]': [i32; _]
|
||||
[119; 120) '1': i32
|
||||
[131; 132) '_': i32
|
||||
[136; 140) '&[3]': &[i32;_]
|
||||
[137; 140) '[3]': [i32;_]
|
||||
[136; 140) '&[3]': &[i32; _]
|
||||
[137; 140) '[3]': [i32; _]
|
||||
[138; 139) '3': i32
|
||||
"###
|
||||
);
|
||||
|
@ -316,18 +316,18 @@ fn test(i: i32) {
|
|||
[70; 147) 'match ... }': &[i32]
|
||||
[76; 77) 'i': i32
|
||||
[88; 89) '1': i32
|
||||
[93; 97) '&[1]': &[i32;_]
|
||||
[94; 97) '[1]': [i32;_]
|
||||
[93; 97) '&[1]': &[i32; _]
|
||||
[94; 97) '[1]': [i32; _]
|
||||
[95; 96) '1': i32
|
||||
[107; 108) '2': i32
|
||||
[112; 115) 'foo': fn foo<i32>(&[T]) -> &[T]
|
||||
[112; 121) 'foo(&[2])': &[i32]
|
||||
[116; 120) '&[2]': &[i32;_]
|
||||
[117; 120) '[2]': [i32;_]
|
||||
[116; 120) '&[2]': &[i32; _]
|
||||
[117; 120) '[2]': [i32; _]
|
||||
[118; 119) '2': i32
|
||||
[131; 132) '_': i32
|
||||
[136; 140) '&[3]': &[i32;_]
|
||||
[137; 140) '[3]': [i32;_]
|
||||
[136; 140) '&[3]': &[i32; _]
|
||||
[137; 140) '[3]': [i32; _]
|
||||
[138; 139) '3': i32
|
||||
"###
|
||||
);
|
||||
|
|
|
@ -102,7 +102,7 @@ fn test() {
|
|||
[11; 48) '{ ...&y]; }': ()
|
||||
[21; 22) 'y': &{unknown}
|
||||
[25; 32) 'unknown': &{unknown}
|
||||
[38; 45) '[y, &y]': [&&{unknown};_]
|
||||
[38; 45) '[y, &y]': [&&{unknown}; _]
|
||||
[39; 40) 'y': &{unknown}
|
||||
[42; 44) '&y': &&{unknown}
|
||||
[43; 44) 'y': &{unknown}
|
||||
|
@ -128,7 +128,7 @@ fn test() {
|
|||
[25; 32) 'unknown': &&{unknown}
|
||||
[42; 43) 'y': &&{unknown}
|
||||
[46; 53) 'unknown': &&{unknown}
|
||||
[59; 77) '[(x, y..., &x)]': [(&&&{unknown}, &&&{unknown});_]
|
||||
[59; 77) '[(x, y..., &x)]': [(&&&{unknown}, &&&{unknown}); _]
|
||||
[60; 66) '(x, y)': (&&&{unknown}, &&&{unknown})
|
||||
[61; 62) 'x': &&{unknown}
|
||||
[64; 65) 'y': &&{unknown}
|
||||
|
@ -180,8 +180,8 @@ fn test_line_buffer() {
|
|||
"#),
|
||||
@r###"
|
||||
[23; 53) '{ ...n']; }': ()
|
||||
[29; 50) '&[0, b...b'\n']': &[u8;_]
|
||||
[30; 50) '[0, b'...b'\n']': [u8;_]
|
||||
[29; 50) '&[0, b...b'\n']': &[u8; _]
|
||||
[30; 50) '[0, b'...b'\n']': [u8; _]
|
||||
[31; 32) '0': u8
|
||||
[34; 39) 'b'\n'': u8
|
||||
[41; 42) '1': u8
|
||||
|
|
|
@ -28,7 +28,7 @@ mod boxed {
|
|||
|
||||
"#,
|
||||
);
|
||||
assert_eq!("(Box<i32>, Box<Box<i32>>, Box<&i32>, Box<[i32;_]>)", type_at_pos(&db, pos));
|
||||
assert_eq!("(Box<i32>, Box<Box<i32>>, Box<&i32>, Box<[i32; _]>)", type_at_pos(&db, pos));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1061,55 +1061,55 @@ fn test(x: &str, y: isize) {
|
|||
[9; 10) 'x': &str
|
||||
[18; 19) 'y': isize
|
||||
[28; 293) '{ ... []; }': ()
|
||||
[38; 39) 'a': [&str;_]
|
||||
[42; 45) '[x]': [&str;_]
|
||||
[38; 39) 'a': [&str; _]
|
||||
[42; 45) '[x]': [&str; _]
|
||||
[43; 44) 'x': &str
|
||||
[55; 56) 'b': [[&str;_];_]
|
||||
[59; 65) '[a, a]': [[&str;_];_]
|
||||
[60; 61) 'a': [&str;_]
|
||||
[63; 64) 'a': [&str;_]
|
||||
[75; 76) 'c': [[[&str;_];_];_]
|
||||
[79; 85) '[b, b]': [[[&str;_];_];_]
|
||||
[80; 81) 'b': [[&str;_];_]
|
||||
[83; 84) 'b': [[&str;_];_]
|
||||
[96; 97) 'd': [isize;_]
|
||||
[100; 112) '[y, 1, 2, 3]': [isize;_]
|
||||
[55; 56) 'b': [[&str; _]; _]
|
||||
[59; 65) '[a, a]': [[&str; _]; _]
|
||||
[60; 61) 'a': [&str; _]
|
||||
[63; 64) 'a': [&str; _]
|
||||
[75; 76) 'c': [[[&str; _]; _]; _]
|
||||
[79; 85) '[b, b]': [[[&str; _]; _]; _]
|
||||
[80; 81) 'b': [[&str; _]; _]
|
||||
[83; 84) 'b': [[&str; _]; _]
|
||||
[96; 97) 'd': [isize; _]
|
||||
[100; 112) '[y, 1, 2, 3]': [isize; _]
|
||||
[101; 102) 'y': isize
|
||||
[104; 105) '1': isize
|
||||
[107; 108) '2': isize
|
||||
[110; 111) '3': isize
|
||||
[122; 123) 'd': [isize;_]
|
||||
[126; 138) '[1, y, 2, 3]': [isize;_]
|
||||
[122; 123) 'd': [isize; _]
|
||||
[126; 138) '[1, y, 2, 3]': [isize; _]
|
||||
[127; 128) '1': isize
|
||||
[130; 131) 'y': isize
|
||||
[133; 134) '2': isize
|
||||
[136; 137) '3': isize
|
||||
[148; 149) 'e': [isize;_]
|
||||
[152; 155) '[y]': [isize;_]
|
||||
[148; 149) 'e': [isize; _]
|
||||
[152; 155) '[y]': [isize; _]
|
||||
[153; 154) 'y': isize
|
||||
[165; 166) 'f': [[isize;_];_]
|
||||
[169; 175) '[d, d]': [[isize;_];_]
|
||||
[170; 171) 'd': [isize;_]
|
||||
[173; 174) 'd': [isize;_]
|
||||
[185; 186) 'g': [[isize;_];_]
|
||||
[189; 195) '[e, e]': [[isize;_];_]
|
||||
[190; 191) 'e': [isize;_]
|
||||
[193; 194) 'e': [isize;_]
|
||||
[206; 207) 'h': [i32;_]
|
||||
[210; 216) '[1, 2]': [i32;_]
|
||||
[165; 166) 'f': [[isize; _]; _]
|
||||
[169; 175) '[d, d]': [[isize; _]; _]
|
||||
[170; 171) 'd': [isize; _]
|
||||
[173; 174) 'd': [isize; _]
|
||||
[185; 186) 'g': [[isize; _]; _]
|
||||
[189; 195) '[e, e]': [[isize; _]; _]
|
||||
[190; 191) 'e': [isize; _]
|
||||
[193; 194) 'e': [isize; _]
|
||||
[206; 207) 'h': [i32; _]
|
||||
[210; 216) '[1, 2]': [i32; _]
|
||||
[211; 212) '1': i32
|
||||
[214; 215) '2': i32
|
||||
[226; 227) 'i': [&str;_]
|
||||
[230; 240) '["a", "b"]': [&str;_]
|
||||
[226; 227) 'i': [&str; _]
|
||||
[230; 240) '["a", "b"]': [&str; _]
|
||||
[231; 234) '"a"': &str
|
||||
[236; 239) '"b"': &str
|
||||
[251; 252) 'b': [[&str;_];_]
|
||||
[255; 265) '[a, ["b"]]': [[&str;_];_]
|
||||
[256; 257) 'a': [&str;_]
|
||||
[259; 264) '["b"]': [&str;_]
|
||||
[251; 252) 'b': [[&str; _]; _]
|
||||
[255; 265) '[a, ["b"]]': [[&str; _]; _]
|
||||
[256; 257) 'a': [&str; _]
|
||||
[259; 264) '["b"]': [&str; _]
|
||||
[260; 263) '"b"': &str
|
||||
[275; 276) 'x': [u8;_]
|
||||
[288; 290) '[]': [u8;_]
|
||||
[275; 276) 'x': [u8; _]
|
||||
[288; 290) '[]': [u8; _]
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@ fn indexing_arrays() {
|
|||
@r###"
|
||||
[10; 26) '{ &mut...[2]; }': ()
|
||||
[12; 23) '&mut [9][2]': &mut {unknown}
|
||||
[17; 20) '[9]': [i32;_]
|
||||
[17; 20) '[9]': [i32; _]
|
||||
[17; 23) '[9][2]': {unknown}
|
||||
[18; 19) '9': i32
|
||||
[21; 22) '2': i32
|
||||
|
|
Loading…
Reference in a new issue