Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 0ce0608

Browse files
committed
Fix inlay-hint tests
1 parent 199bc82 commit 0ce0608

File tree

2 files changed

+18
-111
lines changed

2 files changed

+18
-111
lines changed

crates/ide/src/inlay_hints/bind_pat.rs

Lines changed: 12 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,12 @@ fn pat_is_enum_variant(db: &RootDatabase, bind_pat: &ast::IdentPat, pat_ty: &hir
176176
mod tests {
177177
// This module also contains tests for super::closure_ret
178178

179-
use expect_test::expect;
180179
use syntax::{TextRange, TextSize};
181180
use test_utils::extract_annotations;
182181

183182
use crate::{fixture, inlay_hints::InlayHintsConfig};
184183

185-
use crate::inlay_hints::tests::{
186-
check, check_expect, check_with_config, DISABLED_CONFIG, TEST_CONFIG,
187-
};
184+
use crate::inlay_hints::tests::{check, check_with_config, DISABLED_CONFIG, TEST_CONFIG};
188185
use crate::ClosureReturnTypeHints;
189186

190187
#[track_caller]
@@ -278,8 +275,7 @@ fn main() {
278275
#[test]
279276
fn iterator_hint_regression_issue_12674() {
280277
// Ensure we don't crash while solving the projection type of iterators.
281-
check_expect(
282-
InlayHintsConfig { chaining_hints: true, ..DISABLED_CONFIG },
278+
let (analysis, file_id) = fixture::file(
283279
r#"
284280
//- minicore: iterators
285281
struct S<T>(T);
@@ -302,107 +298,18 @@ impl<'a, T> Iterator for SliceIter<'a, T> {
302298
303299
fn main(a: SliceIter<'_, Container>) {
304300
a
305-
.filter_map(|c| Some(c.elements.iter().filter_map(|v| Some(v))))
306-
.map(|e| e);
301+
.filter_map(|c| Some(c.elements.iter().filter_map(|v| Some(v))))
302+
.map(|e| e);
307303
}
308-
"#,
309-
expect![[r#"
310-
[
311-
InlayHint {
312-
range: 484..554,
313-
kind: Chaining,
314-
label: [
315-
"impl ",
316-
InlayHintLabelPart {
317-
text: "Iterator",
318-
linked_location: Some(
319-
FileRange {
320-
file_id: FileId(
321-
1,
322-
),
323-
range: 2611..2619,
324-
},
325-
),
326-
tooltip: "",
327-
},
328-
"<",
329-
InlayHintLabelPart {
330-
text: "Item",
331-
linked_location: Some(
332-
FileRange {
333-
file_id: FileId(
334-
1,
335-
),
336-
range: 2643..2647,
337-
},
338-
),
339-
tooltip: "",
340-
},
341-
" = impl ",
342-
InlayHintLabelPart {
343-
text: "Iterator",
344-
linked_location: Some(
345-
FileRange {
346-
file_id: FileId(
347-
1,
348-
),
349-
range: 2611..2619,
350-
},
351-
),
352-
tooltip: "",
353-
},
354-
"<",
355-
InlayHintLabelPart {
356-
text: "Item",
357-
linked_location: Some(
358-
FileRange {
359-
file_id: FileId(
360-
1,
361-
),
362-
range: 2643..2647,
363-
},
364-
),
365-
tooltip: "",
366-
},
367-
" = &&str>>",
368-
],
369-
},
370-
InlayHint {
371-
range: 484..485,
372-
kind: Chaining,
373-
label: [
374-
"",
375-
InlayHintLabelPart {
376-
text: "SliceIter",
377-
linked_location: Some(
378-
FileRange {
379-
file_id: FileId(
380-
0,
381-
),
382-
range: 289..298,
383-
},
384-
),
385-
tooltip: "",
386-
},
387-
"<",
388-
InlayHintLabelPart {
389-
text: "Container",
390-
linked_location: Some(
391-
FileRange {
392-
file_id: FileId(
393-
0,
394-
),
395-
range: 238..247,
396-
},
397-
),
398-
tooltip: "",
399-
},
400-
">",
401-
],
402-
},
403-
]
404-
"#]],
304+
"#,
405305
);
306+
analysis
307+
.inlay_hints(
308+
&InlayHintsConfig { chaining_hints: true, ..DISABLED_CONFIG },
309+
file_id,
310+
None,
311+
)
312+
.unwrap();
406313
}
407314

408315
#[test]

crates/ide/src/inlay_hints/chaining.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ fn main() {
435435
file_id: FileId(
436436
1,
437437
),
438-
range: 2611..2619,
438+
range: 3386..3394,
439439
},
440440
),
441441
tooltip: "",
@@ -448,7 +448,7 @@ fn main() {
448448
file_id: FileId(
449449
1,
450450
),
451-
range: 2643..2647,
451+
range: 3418..3422,
452452
},
453453
),
454454
tooltip: "",
@@ -468,7 +468,7 @@ fn main() {
468468
file_id: FileId(
469469
1,
470470
),
471-
range: 2611..2619,
471+
range: 3386..3394,
472472
},
473473
),
474474
tooltip: "",
@@ -481,7 +481,7 @@ fn main() {
481481
file_id: FileId(
482482
1,
483483
),
484-
range: 2643..2647,
484+
range: 3418..3422,
485485
},
486486
),
487487
tooltip: "",
@@ -501,7 +501,7 @@ fn main() {
501501
file_id: FileId(
502502
1,
503503
),
504-
range: 2611..2619,
504+
range: 3386..3394,
505505
},
506506
),
507507
tooltip: "",
@@ -514,7 +514,7 @@ fn main() {
514514
file_id: FileId(
515515
1,
516516
),
517-
range: 2643..2647,
517+
range: 3418..3422,
518518
},
519519
),
520520
tooltip: "",

0 commit comments

Comments
 (0)