Skip to content

Commit 5c0c794

Browse files
Put dyn inlay hints in their correct place in presence of parentheses
1 parent e4e9404 commit 5c0c794

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/tools/rust-analyzer/crates/ide/src/inlay_hints/implied_dyn_trait.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(super) fn hints(
3838
return None;
3939
}
4040
sema.resolve_trait(&path.path()?)?;
41-
paren.map_or_else(|| path.syntax().text_range(), |it| it.text_range())
41+
path.syntax().text_range()
4242
}
4343
Either::Right(dyn_) => {
4444
if dyn_.dyn_token().is_some() {
@@ -93,7 +93,7 @@ fn foo(_: &T, _: for<'a> T) {}
9393
impl T {}
9494
// ^ dyn
9595
impl T for (T) {}
96-
// ^^^ dyn
96+
// ^ dyn
9797
impl T
9898
"#,
9999
);
@@ -116,7 +116,7 @@ fn foo(
116116
_: &mut (T + T)
117117
// ^^^^^ dyn
118118
_: *mut (T),
119-
// ^^^ dyn
119+
// ^ dyn
120120
) {}
121121
"#,
122122
);
@@ -151,4 +151,15 @@ fn test<F>(f: F) where F: for<'a> FnOnce(&'a i32) {}
151151
"#,
152152
);
153153
}
154+
155+
#[test]
156+
fn with_parentheses() {
157+
check(
158+
r#"
159+
trait T {}
160+
fn foo(v: &(T)) {}
161+
// ^ dyn
162+
"#,
163+
);
164+
}
154165
}

0 commit comments

Comments
 (0)