mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 17:28:09 +00:00
Skip adjustment hints if the adjustment doesn't adjust
This commit is contained in:
parent
91a89efcf2
commit
874ff2bc9d
1 changed files with 20 additions and 0 deletions
|
@ -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 };
|
||||
}
|
||||
"#,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue