Fix inlay-hint tests being invalidated by minicore chanes
This commit is contained in:
parent
6ddccc9a6e
commit
d5faad1dae
@ -3403,6 +3403,10 @@ pub fn is_negative(self, db: &dyn HirDatabase) -> bool {
|
|||||||
db.impl_data(self.id).is_negative
|
db.impl_data(self.id).is_negative
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_unsafe(self, db: &dyn HirDatabase) -> bool {
|
||||||
|
db.impl_data(self.id).is_unique()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn module(self, db: &dyn HirDatabase) -> Module {
|
pub fn module(self, db: &dyn HirDatabase) -> Module {
|
||||||
self.id.lookup(db.upcast()).container.into()
|
self.id.lookup(db.upcast()).container.into()
|
||||||
}
|
}
|
||||||
|
@ -563,6 +563,7 @@ mod tests {
|
|||||||
use hir::ClosureStyle;
|
use hir::ClosureStyle;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use test_utils::extract_annotations;
|
use test_utils::extract_annotations;
|
||||||
|
use text_edit::{TextRange, TextSize};
|
||||||
|
|
||||||
use crate::inlay_hints::{AdjustmentHints, AdjustmentHintsMode};
|
use crate::inlay_hints::{AdjustmentHints, AdjustmentHintsMode};
|
||||||
use crate::DiscriminantHints;
|
use crate::DiscriminantHints;
|
||||||
@ -629,6 +630,22 @@ pub(super) fn check_expect(config: InlayHintsConfig, ra_fixture: &str, expect: E
|
|||||||
expect.assert_debug_eq(&inlay_hints)
|
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
|
/// Computes inlay hints for the fixture, applies all the provided text edits and then runs
|
||||||
/// expect test.
|
/// expect test.
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
|
@ -78,7 +78,9 @@ mod tests {
|
|||||||
use expect_test::expect;
|
use expect_test::expect;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
inlay_hints::tests::{check_expect, check_with_config, DISABLED_CONFIG, TEST_CONFIG},
|
inlay_hints::tests::{
|
||||||
|
check_expect, check_expect_clear_loc, check_with_config, DISABLED_CONFIG, TEST_CONFIG,
|
||||||
|
},
|
||||||
InlayHintsConfig,
|
InlayHintsConfig,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -444,7 +446,7 @@ fn main() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn shorten_iterator_chaining_hints() {
|
fn shorten_iterator_chaining_hints() {
|
||||||
check_expect(
|
check_expect_clear_loc(
|
||||||
InlayHintsConfig { chaining_hints: true, ..DISABLED_CONFIG },
|
InlayHintsConfig { chaining_hints: true, ..DISABLED_CONFIG },
|
||||||
r#"
|
r#"
|
||||||
//- minicore: iterators
|
//- minicore: iterators
|
||||||
@ -484,7 +486,7 @@ fn main() {
|
|||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 10752..10760,
|
range: 0..0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
@ -497,7 +499,7 @@ fn main() {
|
|||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 10784..10788,
|
range: 0..0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
@ -522,7 +524,7 @@ fn main() {
|
|||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 10752..10760,
|
range: 0..0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
@ -535,7 +537,7 @@ fn main() {
|
|||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 10784..10788,
|
range: 0..0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
@ -560,7 +562,7 @@ fn main() {
|
|||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 10752..10760,
|
range: 0..0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
@ -573,7 +575,7 @@ fn main() {
|
|||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 10784..10788,
|
range: 0..0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
@ -598,7 +600,7 @@ fn main() {
|
|||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
0,
|
0,
|
||||||
),
|
),
|
||||||
range: 24..30,
|
range: 0..0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
|
Loading…
Reference in New Issue
Block a user