aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/inlay_hints.rs31
1 files changed, 15 insertions, 16 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs
index 9cd33d0e4..335d57a0d 100644
--- a/crates/ide/src/inlay_hints.rs
+++ b/crates/ide/src/inlay_hints.rs
@@ -434,7 +434,6 @@ fn get_callable(
434#[cfg(test)] 434#[cfg(test)]
435mod tests { 435mod tests {
436 use expect_test::{expect, Expect}; 436 use expect_test::{expect, Expect};
437 use ide_db::helpers::FamousDefs;
438 use test_utils::extract_annotations; 437 use test_utils::extract_annotations;
439 438
440 use crate::{fixture, inlay_hints::InlayHintsConfig}; 439 use crate::{fixture, inlay_hints::InlayHintsConfig};
@@ -487,8 +486,6 @@ mod tests {
487 } 486 }
488 487
489 fn check_with_config(config: InlayHintsConfig, ra_fixture: &str) { 488 fn check_with_config(config: InlayHintsConfig, ra_fixture: &str) {
490 let ra_fixture =
491 format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE);
492 let (analysis, file_id) = fixture::file(&ra_fixture); 489 let (analysis, file_id) = fixture::file(&ra_fixture);
493 let expected = extract_annotations(&*analysis.file_text(file_id).unwrap()); 490 let expected = extract_annotations(&*analysis.file_text(file_id).unwrap());
494 let inlay_hints = analysis.inlay_hints(file_id, &config).unwrap(); 491 let inlay_hints = analysis.inlay_hints(file_id, &config).unwrap();
@@ -498,8 +495,6 @@ mod tests {
498 } 495 }
499 496
500 fn check_expect(config: InlayHintsConfig, ra_fixture: &str, expect: Expect) { 497 fn check_expect(config: InlayHintsConfig, ra_fixture: &str, expect: Expect) {
501 let ra_fixture =
502 format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE);
503 let (analysis, file_id) = fixture::file(&ra_fixture); 498 let (analysis, file_id) = fixture::file(&ra_fixture);
504 let inlay_hints = analysis.inlay_hints(file_id, &config).unwrap(); 499 let inlay_hints = analysis.inlay_hints(file_id, &config).unwrap();
505 expect.assert_debug_eq(&inlay_hints) 500 expect.assert_debug_eq(&inlay_hints)
@@ -823,6 +818,7 @@ fn main() {
823 fn shorten_iterators_in_associated_params() { 818 fn shorten_iterators_in_associated_params() {
824 check_types( 819 check_types(
825 r#" 820 r#"
821//- minicore: iterators
826use core::iter; 822use core::iter;
827 823
828pub struct SomeIter<T> {} 824pub struct SomeIter<T> {}
@@ -875,7 +871,7 @@ fn main() {
875 fn fn_hints() { 871 fn fn_hints() {
876 check_types( 872 check_types(
877 r#" 873 r#"
878trait Sized {} 874//- minicore: fn, sized
879 875
880fn foo() -> impl Fn() { loop {} } 876fn foo() -> impl Fn() { loop {} }
881fn foo1() -> impl Fn(f64) { loop {} } 877fn foo1() -> impl Fn(f64) { loop {} }
@@ -1073,6 +1069,7 @@ fn main() {
1073 fn complete_for_hint() { 1069 fn complete_for_hint() {
1074 check_types( 1070 check_types(
1075 r#" 1071 r#"
1072//- minicore: iterator
1076pub struct Vec<T> {} 1073pub struct Vec<T> {}
1077 1074
1078impl<T> Vec<T> { 1075impl<T> Vec<T> {
@@ -1129,6 +1126,7 @@ fn main() {
1129 fn shorten_iterator_hints() { 1126 fn shorten_iterator_hints() {
1130 check_types( 1127 check_types(
1131 r#" 1128 r#"
1129//- minicore: iterators
1132use core::iter; 1130use core::iter;
1133 1131
1134struct MyIter; 1132struct MyIter;
@@ -1230,12 +1228,12 @@ fn main() {
1230 expect![[r#" 1228 expect![[r#"
1231 [ 1229 [
1232 InlayHint { 1230 InlayHint {
1233 range: 148..173, 1231 range: 147..172,
1234 kind: ChainingHint, 1232 kind: ChainingHint,
1235 label: "B", 1233 label: "B",
1236 }, 1234 },
1237 InlayHint { 1235 InlayHint {
1238 range: 148..155, 1236 range: 147..154,
1239 kind: ChainingHint, 1237 kind: ChainingHint,
1240 label: "A", 1238 label: "A",
1241 }, 1239 },
@@ -1290,12 +1288,12 @@ fn main() {
1290 expect![[r#" 1288 expect![[r#"
1291 [ 1289 [
1292 InlayHint { 1290 InlayHint {
1293 range: 144..191, 1291 range: 143..190,
1294 kind: ChainingHint, 1292 kind: ChainingHint,
1295 label: "C", 1293 label: "C",
1296 }, 1294 },
1297 InlayHint { 1295 InlayHint {
1298 range: 144..180, 1296 range: 143..179,
1299 kind: ChainingHint, 1297 kind: ChainingHint,
1300 label: "B", 1298 label: "B",
1301 }, 1299 },
@@ -1335,12 +1333,12 @@ fn main() {
1335 expect![[r#" 1333 expect![[r#"
1336 [ 1334 [
1337 InlayHint { 1335 InlayHint {
1338 range: 247..284, 1336 range: 246..283,
1339 kind: ChainingHint, 1337 kind: ChainingHint,
1340 label: "B<X<i32, bool>>", 1338 label: "B<X<i32, bool>>",
1341 }, 1339 },
1342 InlayHint { 1340 InlayHint {
1343 range: 247..266, 1341 range: 246..265,
1344 kind: ChainingHint, 1342 kind: ChainingHint,
1345 label: "A<X<i32, bool>>", 1343 label: "A<X<i32, bool>>",
1346 }, 1344 },
@@ -1359,6 +1357,7 @@ fn main() {
1359 max_length: None, 1357 max_length: None,
1360 }, 1358 },
1361 r#" 1359 r#"
1360//- minicore: iterators
1362use core::iter; 1361use core::iter;
1363 1362
1364struct MyIter; 1363struct MyIter;
@@ -1381,22 +1380,22 @@ fn main() {
1381 expect![[r#" 1380 expect![[r#"
1382 [ 1381 [
1383 InlayHint { 1382 InlayHint {
1384 range: 175..242, 1383 range: 174..241,
1385 kind: ChainingHint, 1384 kind: ChainingHint,
1386 label: "impl Iterator<Item = ()>", 1385 label: "impl Iterator<Item = ()>",
1387 }, 1386 },
1388 InlayHint { 1387 InlayHint {
1389 range: 175..225, 1388 range: 174..224,
1390 kind: ChainingHint, 1389 kind: ChainingHint,
1391 label: "impl Iterator<Item = ()>", 1390 label: "impl Iterator<Item = ()>",
1392 }, 1391 },
1393 InlayHint { 1392 InlayHint {
1394 range: 175..207, 1393 range: 174..206,
1395 kind: ChainingHint, 1394 kind: ChainingHint,
1396 label: "impl Iterator<Item = ()>", 1395 label: "impl Iterator<Item = ()>",
1397 }, 1396 },
1398 InlayHint { 1397 InlayHint {
1399 range: 175..190, 1398 range: 174..189,
1400 kind: ChainingHint, 1399 kind: ChainingHint,
1401 label: "&mut MyIter", 1400 label: "&mut MyIter",
1402 }, 1401 },