Skip to content

Commit 874ff2b

Browse files
committed
Skip adjustment hints if the adjustment doesn't adjust
1 parent 91a89ef commit 874ff2b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

crates/ide/src/inlay_hints/adjustment.rs

+20
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ pub(super) fn hints(
5959
});
6060
}
6161
for adjustment in adjustments.into_iter().rev() {
62+
if adjustment.source == adjustment.target {
63+
continue;
64+
}
65+
6266
// FIXME: Add some nicer tooltips to each of these
6367
let text = match adjustment.kind {
6468
Adjust::NeverToAny if config.adjustment_hints == AdjustmentHints::Always => {
@@ -213,4 +217,20 @@ impl Trait for Struct {}
213217
"#,
214218
)
215219
}
220+
221+
#[test]
222+
fn never_to_never_is_never_shown() {
223+
check_with_config(
224+
InlayHintsConfig { adjustment_hints: AdjustmentHints::Always, ..DISABLED_CONFIG },
225+
r#"
226+
fn never() -> ! {
227+
return loop {};
228+
}
229+
230+
fn or_else() {
231+
let () = () else { return };
232+
}
233+
"#,
234+
)
235+
}
216236
}

0 commit comments

Comments
 (0)