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.rs15
1 files changed, 13 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..4fbc88a210 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]
@@ -125,7 +136,7 @@ fn foo(
#[test]
fn edit() {
check_edit(
- DISABLED_CONFIG,
+ InlayHintsConfig { implied_dyn_trait_hints: true, ..DISABLED_CONFIG },
r#"
trait T {}
fn foo(