Open Settings.json and enter the following.

I am using Darcula theme so I am wrapping colorCustomizations inside that key.

  • You can remove that key if you want color customizations to be applied across all themes.
  • Change color for typeForeground and typeBackground to your likings
  • Uncomment line which has offUnlessPressed to toggle inlayHints upon keypress CTRL + alt
    "workbench.colorCustomizations": {
      [Darcula]: {
          "editorInlayHint.typeForeground": "#525252",
          "editorInlayHint.typeBackground": "#2D2D2D"
        },
      }

    "[rust]": {
        "editor.defaultFormatter": "rust-lang.rust-analyzer"
        // "editor.inlayHints.enabled": "offUnlessPressed"
    },
    "rust-analyzer.inlayHints.bindingModeHints.enable": false,
    "rust-analyzer.inlayHints.closureReturnTypeHints.enable": "never",
    "rust-analyzer.inlayHints.typeHints.enable": false,
    "rust-analyzer.inlayHints.parameterHints.enable": false,

This is how it looks after inlay hints setting change.

Vscode settings for inlay hints

visit https://github.com/rust-lang/rust-analyzer/issues/4334 for issue discussions.