mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Put dyn
inlay hints in their correct place in presence of parentheses
This commit is contained in:
parent
3931afa624
commit
a8e67dffca
@ -38,7 +38,7 @@ pub(super) fn hints(
|
||||
return None;
|
||||
}
|
||||
sema.resolve_trait(&path.path()?)?;
|
||||
paren.map_or_else(|| path.syntax().text_range(), |it| it.text_range())
|
||||
path.syntax().text_range()
|
||||
}
|
||||
Either::Right(dyn_) => {
|
||||
if dyn_.dyn_token().is_some() {
|
||||
@ -93,7 +93,7 @@ fn foo(_: &T, _: for<'a> T) {}
|
||||
impl T {}
|
||||
// ^ dyn
|
||||
impl T for (T) {}
|
||||
// ^^^ dyn
|
||||
// ^ dyn
|
||||
impl T
|
||||
"#,
|
||||
);
|
||||
@ -116,7 +116,7 @@ fn foo(
|
||||
_: &mut (T + T)
|
||||
// ^^^^^ dyn
|
||||
_: *mut (T),
|
||||
// ^^^ dyn
|
||||
// ^ dyn
|
||||
) {}
|
||||
"#,
|
||||
);
|
||||
@ -151,4 +151,15 @@ fn test<F>(f: F) where F: for<'a> FnOnce(&'a i32) {}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_parentheses() {
|
||||
check(
|
||||
r#"
|
||||
trait T {}
|
||||
fn foo(v: &(T)) {}
|
||||
// ^ dyn
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user