RustRover 2023.3 Help

Intentions and quick-fixes

When RustRover finds a way to fix, improve, or optimize your code, it displays either a yellow bulb icon yellow bulb icon (intention suggested) or a red bulb with an exclamation mark the Quick-fix icon (quick-fix suggested) in the editor next to the corresponding line.

Apply a quick fix/intention

  1. Hover over the problematic code and press Alt+Enter (or click Quick fix button/Intention button).

  2. Select the preferred action from the list.

Intentions bulb

A few examples of Rust-specific intentions and quick-fixes are given below.

  • The Add missing fields quick-fix helps you interactively define field values of struct literals:

    The Add missing fields quick-fix
  • You can quickly add #[derive] clauses and impl blocks for structs and enums, and perform struct-to-tuple and tuple-to-struct conversion:

    Struct intentions
  • For all unresolved references in your code, there's a handy auto-import quick-fix:

    Import quick-fix
  • RustRover checks match expressions in your code and suggests removing unreachable patterns and adding the missing ones, which includes the cases of complex patterns with multiple types. This inspection also supports match ergonomics.

    Match quick-fixes

You can find the full list of Rust intentions and adjust them if necessary in Settings | Editor | Intentions | Rust:

Intentions for Rust

Last modified: 13 September 2023