mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Fix inlay-hint tests being invalidated by minicore chanes
This commit is contained in:
parent
6ddccc9a6e
commit
d5faad1dae
3 changed files with 32 additions and 9 deletions
|
@ -563,6 +563,7 @@ mod tests {
|
|||
use hir::ClosureStyle;
|
||||
use itertools::Itertools;
|
||||
use test_utils::extract_annotations;
|
||||
use text_edit::{TextRange, TextSize};
|
||||
|
||||
use crate::inlay_hints::{AdjustmentHints, AdjustmentHintsMode};
|
||||
use crate::DiscriminantHints;
|
||||
|
@ -629,6 +630,22 @@ mod tests {
|
|||
expect.assert_debug_eq(&inlay_hints)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub(super) fn check_expect_clear_loc(
|
||||
config: InlayHintsConfig,
|
||||
ra_fixture: &str,
|
||||
expect: Expect,
|
||||
) {
|
||||
let (analysis, file_id) = fixture::file(ra_fixture);
|
||||
let mut inlay_hints = analysis.inlay_hints(&config, file_id, None).unwrap();
|
||||
inlay_hints.iter_mut().flat_map(|hint| &mut hint.label.parts).for_each(|hint| {
|
||||
if let Some(loc) = &mut hint.linked_location {
|
||||
loc.range = TextRange::empty(TextSize::from(0));
|
||||
}
|
||||
});
|
||||
expect.assert_debug_eq(&inlay_hints)
|
||||
}
|
||||
|
||||
/// Computes inlay hints for the fixture, applies all the provided text edits and then runs
|
||||
/// expect test.
|
||||
#[track_caller]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue