Code completion
Auto-completion for your Rust code works as you type, and you can also call it manually from
on the main menu.For example, completion is available for attributes and elements inside #[derive]
, including standard library traits:
Completion also works inside macro calls. The plugin knows the resulting macro substitution and suggests only the applicable items:
Note that completion is available in doctest comments as well:
Auto-import
RustRover takes care of out-of-scope items: if you select such an item from the completion list, the corresponding use
declaration will be inserted automatically. You can tune auto-import settings in .
You may want to exclude certain items from completion lists and make sure they never get auto-imported. For example, you may want to exclude functions and traits that are re-exported in irrelevant crates – this way, only original ones will be suggested.
Disable completion and auto-import for certain items
Navigate to
.In the table, list the items that you want to exclude from completion and auto-import.
The following rules apply:
Specify each path just as you would in a
use
declaration.Add
::*
to a path if you want to disable auto-import for all items whose paths include the given prefix.When excluding traits, use the Apply to dropdown menu to specify whether you want to disable auto-import only for trait methods or for the trait name too.
Note that exclusion settings are ignored for items already imported with a
use
declaration.
ML completion
Machine learning assisted completion is enabled by default. The suggestions are sorted by their relevance based on the rules learned from data gathered anonymously during the IDE's Early Access Program. Note that your source code is never being collected, only the information about your interactions with the code completion UI.
If you prefer to disable the ML completion feature, clear the corresponding checkbox in
.
Set the Mark position changes in the completion popup checkbox to view the elements that were reordered to the ML data:


Postfix completion
Postfix completion helps you reduce backward caret jumps as you type. You can transform an already-typed expression into a different one based on a postfix you type after the dot.
For example, type .assert
after an expression (or select it from the completion suggestion list) to insert a assert_eq!
invocation:
You can check and adjust the list of postfix templates in
:
To add a custom template, click and select Rust:
Create custom postfix templates
Press Control+Alt+S to open the IDE settings and then select
.Click the Add button (
) on the toolbar and select Rust.
Specify Key, a combination of symbols that will invoke the template.
Select which expression types the new template will be applicable to, and type the target expression in the following format:
$EXPR$ <target_expression>
, for example,$EXPR$ =!null
.