Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/inlay_hints/adjustment.rs')
-rw-r--r--crates/ide/src/inlay_hints/adjustment.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/crates/ide/src/inlay_hints/adjustment.rs b/crates/ide/src/inlay_hints/adjustment.rs
index 983aa1dfd5..b2bec10d05 100644
--- a/crates/ide/src/inlay_hints/adjustment.rs
+++ b/crates/ide/src/inlay_hints/adjustment.rs
@@ -59,8 +59,12 @@ pub(super) fn hints(
});
}
for adjustment in adjustments.into_iter().rev() {
+ if adjustment.source == adjustment.target {
+ continue;
+ }
+
// FIXME: Add some nicer tooltips to each of these
- let text = match adjustment {
+ let text = match adjustment.kind {
Adjust::NeverToAny if config.adjustment_hints == AdjustmentHints::Always => {
"<never-to-any>"
}
@@ -213,4 +217,20 @@ impl Trait for Struct {}
"#,
)
}
+
+ #[test]
+ fn never_to_never_is_never_shown() {
+ check_with_config(
+ InlayHintsConfig { adjustment_hints: AdjustmentHints::Always, ..DISABLED_CONFIG },
+ r#"
+fn never() -> ! {
+ return loop {};
+}
+
+fn or_else() {
+ let () = () else { return };
+}
+ "#,
+ )
+ }
}