Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/inlay_hints/implied_dyn_trait.rs')
| -rw-r--r-- | crates/ide/src/inlay_hints/implied_dyn_trait.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/ide/src/inlay_hints/implied_dyn_trait.rs b/crates/ide/src/inlay_hints/implied_dyn_trait.rs index 562eb1e002..ac91da9a3c 100644 --- a/crates/ide/src/inlay_hints/implied_dyn_trait.rs +++ b/crates/ide/src/inlay_hints/implied_dyn_trait.rs @@ -14,6 +14,10 @@ pub(super) fn hints( config: &InlayHintsConfig<'_>, path: Either<ast::PathType, ast::DynTraitType>, ) -> Option<()> { + if !config.implied_dyn_trait_hints { + return None; + } + let parent = path.syntax().parent()?; let range = match path { Either::Left(path) => { @@ -76,7 +80,14 @@ mod tests { #[track_caller] fn check(#[rust_analyzer::rust_fixture] ra_fixture: &str) { - check_with_config(InlayHintsConfig { sized_bound: true, ..DISABLED_CONFIG }, ra_fixture); + check_with_config( + InlayHintsConfig { + sized_bound: true, + implied_dyn_trait_hints: true, + ..DISABLED_CONFIG + }, + ra_fixture, + ); } #[test] @@ -94,6 +105,7 @@ impl T {} // ^ dyn impl T for (T) {} // ^ dyn +impl T for {} impl T "#, ); @@ -125,7 +137,7 @@ fn foo( #[test] fn edit() { check_edit( - DISABLED_CONFIG, + InlayHintsConfig { implied_dyn_trait_hints: true, ..DISABLED_CONFIG }, r#" trait T {} fn foo( |