diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-12-20 20:04:10 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-12-20 20:04:10 +0000 |
| commit | 874ff2bc9d94072653c3d249bbe260a334c27637 (patch) | |
| tree | 3f337588d0fe9226248c5449512a2c7880bf227b | |
| parent | 91a89efcf29d2281a55cc5723784d0c93f39c01c (diff) | |
| download | rust-874ff2bc9d94072653c3d249bbe260a334c27637.tar.gz rust-874ff2bc9d94072653c3d249bbe260a334c27637.zip | |
Skip adjustment hints if the adjustment doesn't adjust
| -rw-r--r-- | crates/ide/src/inlay_hints/adjustment.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/ide/src/inlay_hints/adjustment.rs b/crates/ide/src/inlay_hints/adjustment.rs index 52cfa452b97..b2bec10d05d 100644 --- a/crates/ide/src/inlay_hints/adjustment.rs +++ b/crates/ide/src/inlay_hints/adjustment.rs @@ -59,6 +59,10 @@ 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.kind { Adjust::NeverToAny if config.adjustment_hints == AdjustmentHints::Always => { @@ -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 }; +} + "#, + ) + } } |
