Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/inlay_hints.rs')
-rw-r--r--crates/ide/src/inlay_hints.rs42
1 files changed, 36 insertions, 6 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs
index 19e5509681..7a8514c47a 100644
--- a/crates/ide/src/inlay_hints.rs
+++ b/crates/ide/src/inlay_hints.rs
@@ -576,13 +576,13 @@ impl InlayHintLabel {
}
pub fn append_part(&mut self, part: InlayHintLabelPart) {
- if part.linked_location.is_none() && part.tooltip.is_none() {
- if let Some(InlayHintLabelPart { text, linked_location: None, tooltip: None }) =
+ if part.linked_location.is_none()
+ && part.tooltip.is_none()
+ && let Some(InlayHintLabelPart { text, linked_location: None, tooltip: None }) =
self.parts.last_mut()
- {
- text.push_str(&part.text);
- return;
- }
+ {
+ text.push_str(&part.text);
+ return;
}
self.parts.push(part);
}
@@ -1065,4 +1065,34 @@ fn bar() {
"#,
);
}
+
+ #[test]
+ fn regression_20239() {
+ check_with_config(
+ InlayHintsConfig { parameter_hints: true, type_hints: true, ..DISABLED_CONFIG },
+ r#"
+//- minicore: fn
+trait Iterator {
+ type Item;
+ fn map<B, F: FnMut(Self::Item) -> B>(self, f: F);
+}
+trait ToString {
+ fn to_string(&self);
+}
+
+fn check_tostr_eq<L, R>(left: L, right: R)
+where
+ L: Iterator,
+ L::Item: ToString,
+ R: Iterator,
+ R::Item: ToString,
+{
+ left.map(|s| s.to_string());
+ // ^ impl ToString
+ right.map(|s| s.to_string());
+ // ^ impl ToString
+}
+ "#,
+ );
+ }
}