diff options
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r-- | crates/ide_db/src/call_info/tests.rs | 54 | ||||
-rw-r--r-- | crates/ide_db/src/defs.rs | 2 | ||||
-rw-r--r-- | crates/ide_db/src/traits/tests.rs | 18 |
3 files changed, 37 insertions, 37 deletions
diff --git a/crates/ide_db/src/call_info/tests.rs b/crates/ide_db/src/call_info/tests.rs index 9335aeaa5..c714cf280 100644 --- a/crates/ide_db/src/call_info/tests.rs +++ b/crates/ide_db/src/call_info/tests.rs | |||
@@ -3,12 +3,12 @@ use base_db::{fixture::ChangeFixture, FilePosition}; | |||
3 | use expect_test::{expect, Expect}; | 3 | use expect_test::{expect, Expect}; |
4 | use test_utils::{mark, RangeOrOffset}; | 4 | use test_utils::{mark, RangeOrOffset}; |
5 | 5 | ||
6 | /// Creates analysis from a multi-file fixture, returns positions marked with <|>. | 6 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. |
7 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { | 7 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { |
8 | let change_fixture = ChangeFixture::parse(ra_fixture); | 8 | let change_fixture = ChangeFixture::parse(ra_fixture); |
9 | let mut database = RootDatabase::default(); | 9 | let mut database = RootDatabase::default(); |
10 | database.apply_change(change_fixture.change); | 10 | database.apply_change(change_fixture.change); |
11 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); | 11 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); |
12 | let offset = match range_or_offset { | 12 | let offset = match range_or_offset { |
13 | RangeOrOffset::Range(_) => panic!(), | 13 | RangeOrOffset::Range(_) => panic!(), |
14 | RangeOrOffset::Offset(it) => it, | 14 | RangeOrOffset::Offset(it) => it, |
@@ -49,7 +49,7 @@ fn test_fn_signature_two_args() { | |||
49 | check( | 49 | check( |
50 | r#" | 50 | r#" |
51 | fn foo(x: u32, y: u32) -> u32 {x + y} | 51 | fn foo(x: u32, y: u32) -> u32 {x + y} |
52 | fn bar() { foo(<|>3, ); } | 52 | fn bar() { foo($03, ); } |
53 | "#, | 53 | "#, |
54 | expect![[r#" | 54 | expect![[r#" |
55 | fn foo(x: u32, y: u32) -> u32 | 55 | fn foo(x: u32, y: u32) -> u32 |
@@ -59,7 +59,7 @@ fn bar() { foo(<|>3, ); } | |||
59 | check( | 59 | check( |
60 | r#" | 60 | r#" |
61 | fn foo(x: u32, y: u32) -> u32 {x + y} | 61 | fn foo(x: u32, y: u32) -> u32 {x + y} |
62 | fn bar() { foo(3<|>, ); } | 62 | fn bar() { foo(3$0, ); } |
63 | "#, | 63 | "#, |
64 | expect![[r#" | 64 | expect![[r#" |
65 | fn foo(x: u32, y: u32) -> u32 | 65 | fn foo(x: u32, y: u32) -> u32 |
@@ -69,7 +69,7 @@ fn bar() { foo(3<|>, ); } | |||
69 | check( | 69 | check( |
70 | r#" | 70 | r#" |
71 | fn foo(x: u32, y: u32) -> u32 {x + y} | 71 | fn foo(x: u32, y: u32) -> u32 {x + y} |
72 | fn bar() { foo(3,<|> ); } | 72 | fn bar() { foo(3,$0 ); } |
73 | "#, | 73 | "#, |
74 | expect![[r#" | 74 | expect![[r#" |
75 | fn foo(x: u32, y: u32) -> u32 | 75 | fn foo(x: u32, y: u32) -> u32 |
@@ -79,7 +79,7 @@ fn bar() { foo(3,<|> ); } | |||
79 | check( | 79 | check( |
80 | r#" | 80 | r#" |
81 | fn foo(x: u32, y: u32) -> u32 {x + y} | 81 | fn foo(x: u32, y: u32) -> u32 {x + y} |
82 | fn bar() { foo(3, <|>); } | 82 | fn bar() { foo(3, $0); } |
83 | "#, | 83 | "#, |
84 | expect![[r#" | 84 | expect![[r#" |
85 | fn foo(x: u32, y: u32) -> u32 | 85 | fn foo(x: u32, y: u32) -> u32 |
@@ -93,7 +93,7 @@ fn test_fn_signature_two_args_empty() { | |||
93 | check( | 93 | check( |
94 | r#" | 94 | r#" |
95 | fn foo(x: u32, y: u32) -> u32 {x + y} | 95 | fn foo(x: u32, y: u32) -> u32 {x + y} |
96 | fn bar() { foo(<|>); } | 96 | fn bar() { foo($0); } |
97 | "#, | 97 | "#, |
98 | expect![[r#" | 98 | expect![[r#" |
99 | fn foo(x: u32, y: u32) -> u32 | 99 | fn foo(x: u32, y: u32) -> u32 |
@@ -110,7 +110,7 @@ fn foo<T, U: Copy + Display>(x: T, y: U) -> u32 | |||
110 | where T: Copy + Display, U: Debug | 110 | where T: Copy + Display, U: Debug |
111 | { x + y } | 111 | { x + y } |
112 | 112 | ||
113 | fn bar() { foo(<|>3, ); } | 113 | fn bar() { foo($03, ); } |
114 | "#, | 114 | "#, |
115 | expect![[r#" | 115 | expect![[r#" |
116 | fn foo(x: i32, y: {unknown}) -> u32 | 116 | fn foo(x: i32, y: {unknown}) -> u32 |
@@ -124,7 +124,7 @@ fn test_fn_signature_no_params() { | |||
124 | check( | 124 | check( |
125 | r#" | 125 | r#" |
126 | fn foo<T>() -> T where T: Copy + Display {} | 126 | fn foo<T>() -> T where T: Copy + Display {} |
127 | fn bar() { foo(<|>); } | 127 | fn bar() { foo($0); } |
128 | "#, | 128 | "#, |
129 | expect![[r#" | 129 | expect![[r#" |
130 | fn foo() -> {unknown} | 130 | fn foo() -> {unknown} |
@@ -140,7 +140,7 @@ fn test_fn_signature_for_impl() { | |||
140 | struct F; | 140 | struct F; |
141 | impl F { pub fn new() { } } | 141 | impl F { pub fn new() { } } |
142 | fn bar() { | 142 | fn bar() { |
143 | let _ : F = F::new(<|>); | 143 | let _ : F = F::new($0); |
144 | } | 144 | } |
145 | "#, | 145 | "#, |
146 | expect![[r#" | 146 | expect![[r#" |
@@ -159,7 +159,7 @@ impl S { pub fn do_it(&self) {} } | |||
159 | 159 | ||
160 | fn bar() { | 160 | fn bar() { |
161 | let s: S = S; | 161 | let s: S = S; |
162 | s.do_it(<|>); | 162 | s.do_it($0); |
163 | } | 163 | } |
164 | "#, | 164 | "#, |
165 | expect![[r#" | 165 | expect![[r#" |
@@ -178,7 +178,7 @@ impl S { | |||
178 | fn foo(&self, x: i32) {} | 178 | fn foo(&self, x: i32) {} |
179 | } | 179 | } |
180 | 180 | ||
181 | fn main() { S.foo(<|>); } | 181 | fn main() { S.foo($0); } |
182 | "#, | 182 | "#, |
183 | expect![[r#" | 183 | expect![[r#" |
184 | fn foo(&self, x: i32) | 184 | fn foo(&self, x: i32) |
@@ -196,7 +196,7 @@ impl S { | |||
196 | fn foo(&self, x: i32) {} | 196 | fn foo(&self, x: i32) {} |
197 | } | 197 | } |
198 | 198 | ||
199 | fn main() { S::foo(<|>); } | 199 | fn main() { S::foo($0); } |
200 | "#, | 200 | "#, |
201 | expect![[r#" | 201 | expect![[r#" |
202 | fn foo(self: &S, x: i32) | 202 | fn foo(self: &S, x: i32) |
@@ -216,7 +216,7 @@ fn foo(j: u32) -> u32 { | |||
216 | } | 216 | } |
217 | 217 | ||
218 | fn bar() { | 218 | fn bar() { |
219 | let _ = foo(<|>); | 219 | let _ = foo($0); |
220 | } | 220 | } |
221 | "#, | 221 | "#, |
222 | expect![[r#" | 222 | expect![[r#" |
@@ -246,7 +246,7 @@ pub fn add_one(x: i32) -> i32 { | |||
246 | } | 246 | } |
247 | 247 | ||
248 | pub fn do() { | 248 | pub fn do() { |
249 | add_one(<|> | 249 | add_one($0 |
250 | }"#, | 250 | }"#, |
251 | expect![[r##" | 251 | expect![[r##" |
252 | Adds one to the number given. | 252 | Adds one to the number given. |
@@ -287,7 +287,7 @@ impl addr { | |||
287 | 287 | ||
288 | pub fn do_it() { | 288 | pub fn do_it() { |
289 | addr {}; | 289 | addr {}; |
290 | addr::add_one(<|>); | 290 | addr::add_one($0); |
291 | } | 291 | } |
292 | "#, | 292 | "#, |
293 | expect![[r##" | 293 | expect![[r##" |
@@ -331,7 +331,7 @@ impl<E> WriteHandler<E> { | |||
331 | } | 331 | } |
332 | 332 | ||
333 | pub fn foo(mut r: WriteHandler<()>) { | 333 | pub fn foo(mut r: WriteHandler<()>) { |
334 | r.finished(<|>); | 334 | r.finished($0); |
335 | } | 335 | } |
336 | "#, | 336 | "#, |
337 | expect![[r#" | 337 | expect![[r#" |
@@ -351,7 +351,7 @@ fn call_info_bad_offset() { | |||
351 | check( | 351 | check( |
352 | r#" | 352 | r#" |
353 | fn foo(x: u32, y: u32) -> u32 {x + y} | 353 | fn foo(x: u32, y: u32) -> u32 {x + y} |
354 | fn bar() { foo <|> (3, ); } | 354 | fn bar() { foo $0 (3, ); } |
355 | "#, | 355 | "#, |
356 | expect![[""]], | 356 | expect![[""]], |
357 | ); | 357 | ); |
@@ -368,7 +368,7 @@ fn bar(_: u32) { } | |||
368 | 368 | ||
369 | fn main() { | 369 | fn main() { |
370 | let foo = Foo; | 370 | let foo = Foo; |
371 | std::thread::spawn(move || foo.bar(<|>)); | 371 | std::thread::spawn(move || foo.bar($0)); |
372 | } | 372 | } |
373 | "#, | 373 | "#, |
374 | expect![[r#" | 374 | expect![[r#" |
@@ -385,7 +385,7 @@ fn works_for_tuple_structs() { | |||
385 | /// A cool tuple struct | 385 | /// A cool tuple struct |
386 | struct S(u32, i32); | 386 | struct S(u32, i32); |
387 | fn main() { | 387 | fn main() { |
388 | let s = S(0, <|>); | 388 | let s = S(0, $0); |
389 | } | 389 | } |
390 | "#, | 390 | "#, |
391 | expect![[r#" | 391 | expect![[r#" |
@@ -403,7 +403,7 @@ fn generic_struct() { | |||
403 | r#" | 403 | r#" |
404 | struct S<T>(T); | 404 | struct S<T>(T); |
405 | fn main() { | 405 | fn main() { |
406 | let s = S(<|>); | 406 | let s = S($0); |
407 | } | 407 | } |
408 | "#, | 408 | "#, |
409 | expect![[r#" | 409 | expect![[r#" |
@@ -427,7 +427,7 @@ enum E { | |||
427 | } | 427 | } |
428 | 428 | ||
429 | fn main() { | 429 | fn main() { |
430 | let a = E::A(<|>); | 430 | let a = E::A($0); |
431 | } | 431 | } |
432 | "#, | 432 | "#, |
433 | expect![[r#" | 433 | expect![[r#" |
@@ -445,7 +445,7 @@ fn cant_call_struct_record() { | |||
445 | r#" | 445 | r#" |
446 | struct S { x: u32, y: i32 } | 446 | struct S { x: u32, y: i32 } |
447 | fn main() { | 447 | fn main() { |
448 | let s = S(<|>); | 448 | let s = S($0); |
449 | } | 449 | } |
450 | "#, | 450 | "#, |
451 | expect![[""]], | 451 | expect![[""]], |
@@ -466,7 +466,7 @@ enum E { | |||
466 | } | 466 | } |
467 | 467 | ||
468 | fn main() { | 468 | fn main() { |
469 | let a = E::C(<|>); | 469 | let a = E::C($0); |
470 | } | 470 | } |
471 | "#, | 471 | "#, |
472 | expect![[""]], | 472 | expect![[""]], |
@@ -480,7 +480,7 @@ fn fn_signature_for_call_in_macro() { | |||
480 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } | 480 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } |
481 | fn foo() { } | 481 | fn foo() { } |
482 | id! { | 482 | id! { |
483 | fn bar() { foo(<|>); } | 483 | fn bar() { foo($0); } |
484 | } | 484 | } |
485 | "#, | 485 | "#, |
486 | expect![[r#" | 486 | expect![[r#" |
@@ -497,7 +497,7 @@ fn call_info_for_lambdas() { | |||
497 | struct S; | 497 | struct S; |
498 | fn foo(s: S) -> i32 { 92 } | 498 | fn foo(s: S) -> i32 { 92 } |
499 | fn main() { | 499 | fn main() { |
500 | (|s| foo(s))(<|>) | 500 | (|s| foo(s))($0) |
501 | } | 501 | } |
502 | "#, | 502 | "#, |
503 | expect![[r#" | 503 | expect![[r#" |
@@ -512,7 +512,7 @@ fn call_info_for_fn_ptr() { | |||
512 | check( | 512 | check( |
513 | r#" | 513 | r#" |
514 | fn main(f: fn(i32, f64) -> char) { | 514 | fn main(f: fn(i32, f64) -> char) { |
515 | f(0, <|>) | 515 | f(0, $0) |
516 | } | 516 | } |
517 | "#, | 517 | "#, |
518 | expect![[r#" | 518 | expect![[r#" |
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index cc5078bf0..be1c64b03 100644 --- a/crates/ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs | |||
@@ -358,7 +358,7 @@ impl NameRefClass { | |||
358 | if let Some(path) = macro_call.path() { | 358 | if let Some(path) = macro_call.path() { |
359 | if path.qualifier().is_none() { | 359 | if path.qualifier().is_none() { |
360 | // Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment | 360 | // Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment |
361 | // paths are handled below (allowing `log<|>::info!` to resolve to the log crate). | 361 | // paths are handled below (allowing `log$0::info!` to resolve to the log crate). |
362 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { | 362 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { |
363 | return Some(NameRefClass::Definition(Definition::Macro(macro_def))); | 363 | return Some(NameRefClass::Definition(Definition::Macro(macro_def))); |
364 | } | 364 | } |
diff --git a/crates/ide_db/src/traits/tests.rs b/crates/ide_db/src/traits/tests.rs index 09c7ac3ec..84bb25505 100644 --- a/crates/ide_db/src/traits/tests.rs +++ b/crates/ide_db/src/traits/tests.rs | |||
@@ -5,12 +5,12 @@ use hir::Semantics; | |||
5 | use syntax::ast::{self, AstNode}; | 5 | use syntax::ast::{self, AstNode}; |
6 | use test_utils::RangeOrOffset; | 6 | use test_utils::RangeOrOffset; |
7 | 7 | ||
8 | /// Creates analysis from a multi-file fixture, returns positions marked with <|>. | 8 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. |
9 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { | 9 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { |
10 | let change_fixture = ChangeFixture::parse(ra_fixture); | 10 | let change_fixture = ChangeFixture::parse(ra_fixture); |
11 | let mut database = RootDatabase::default(); | 11 | let mut database = RootDatabase::default(); |
12 | database.apply_change(change_fixture.change); | 12 | database.apply_change(change_fixture.change); |
13 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); | 13 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); |
14 | let offset = match range_or_offset { | 14 | let offset = match range_or_offset { |
15 | RangeOrOffset::Range(_) => panic!(), | 15 | RangeOrOffset::Range(_) => panic!(), |
16 | RangeOrOffset::Offset(it) => it, | 16 | RangeOrOffset::Offset(it) => it, |
@@ -55,7 +55,7 @@ pub trait Foo { | |||
55 | fn bar(); | 55 | fn bar(); |
56 | } | 56 | } |
57 | impl Foo for u8 { | 57 | impl Foo for u8 { |
58 | <|> | 58 | $0 |
59 | } | 59 | } |
60 | "#, | 60 | "#, |
61 | expect![["Foo"]], | 61 | expect![["Foo"]], |
@@ -68,7 +68,7 @@ pub trait Foo { | |||
68 | impl Foo for u8 { | 68 | impl Foo for u8 { |
69 | fn bar() { | 69 | fn bar() { |
70 | fn baz() { | 70 | fn baz() { |
71 | <|> | 71 | $0 |
72 | } | 72 | } |
73 | baz(); | 73 | baz(); |
74 | } | 74 | } |
@@ -83,7 +83,7 @@ pub trait Foo { | |||
83 | } | 83 | } |
84 | pub struct Bar; | 84 | pub struct Bar; |
85 | impl Bar { | 85 | impl Bar { |
86 | <|> | 86 | $0 |
87 | } | 87 | } |
88 | "#, | 88 | "#, |
89 | expect![[""]], | 89 | expect![[""]], |
@@ -99,7 +99,7 @@ pub trait Foo { | |||
99 | fn bar(); | 99 | fn bar(); |
100 | } | 100 | } |
101 | impl Foo for u8 { | 101 | impl Foo for u8 { |
102 | <|> | 102 | $0 |
103 | }"#, | 103 | }"#, |
104 | expect![[r#" | 104 | expect![[r#" |
105 | FOO | 105 | FOO |
@@ -114,7 +114,7 @@ pub trait Foo { | |||
114 | } | 114 | } |
115 | impl Foo for u8 { | 115 | impl Foo for u8 { |
116 | const FOO: u8 = 10; | 116 | const FOO: u8 = 10; |
117 | <|> | 117 | $0 |
118 | }"#, | 118 | }"#, |
119 | expect![[r#" | 119 | expect![[r#" |
120 | bar"#]], | 120 | bar"#]], |
@@ -128,7 +128,7 @@ pub trait Foo { | |||
128 | } | 128 | } |
129 | impl Foo for u8 { | 129 | impl Foo for u8 { |
130 | const FOO: u8 = 10; | 130 | const FOO: u8 = 10; |
131 | fn bar() {<|>} | 131 | fn bar() {$0} |
132 | }"#, | 132 | }"#, |
133 | expect![[r#""#]], | 133 | expect![[r#""#]], |
134 | ); | 134 | ); |
@@ -137,7 +137,7 @@ impl Foo for u8 { | |||
137 | r#" | 137 | r#" |
138 | pub struct Foo; | 138 | pub struct Foo; |
139 | impl Foo { | 139 | impl Foo { |
140 | fn bar() {<|>} | 140 | fn bar() {$0} |
141 | }"#, | 141 | }"#, |
142 | expect![[r#""#]], | 142 | expect![[r#""#]], |
143 | ); | 143 | ); |