From 947a27b797cd87d5650477441c9c3c03b6364626 Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Thu, 13 Aug 2020 22:13:34 +0200 Subject: display correctly 'impl Trait + Trait' #4814 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/hir_ty/src/display.rs | 1 + crates/ide/src/hover.rs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'crates') diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 19770e609..64b68014d 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -511,6 +511,7 @@ fn write_bounds_like_dyn_trait( GenericPredicate::Implemented(trait_ref) => { if angle_open { write!(f, ">")?; + angle_open = false; } if !first { write!(f, " + ")?; diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 331aa4db0..300c00edc 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -766,6 +766,25 @@ fn main() { ) } + #[test] + fn hover_for_param_with_multiple_traits() { + check( + r#"trait Deref { + type Target: ?Sized; + } + trait DerefMut { + type Target: ?Sized; + } + fn f(_x<|>: impl Deref + DerefMut) {}"#, + expect![[r#" + *_x* + ```rust + impl Deref + DerefMut + ``` + "#]], + ) + } + #[test] fn test_hover_infer_associated_method_result() { check( -- cgit v1.2.3