In the main menu, go to File | Open. In the file chooser, select the directory containing the root Cargo.toml file (or Cargo.toml itself) and click Open:
In the dialog that opens, select Open as project.
When opening the project for the first time, RustRover will prompt you to confirm that you consider it safe.
Click Trust Project if you are certain the project poses no threats and you would like to enable all IDE features. If you have any doubts, select Preview in Safe Mode. For more information, refer to Project security.
Clone a repository from VCS
In the main menu, go to File | New | Project from Version Control or click Get from VCS on the Welcome screen.
Specify the repository URL and the destination directory. Click Clone:
2. Explore the workspace and features
RustRover's feature set is designed to simplify the Rust development process. Let's take a closer look at what it has to offer.
For a summary of all detected problems, use the Inspections widget in the upper-right corner of the editor. To see the details, click the widget and refer to the Problems tool window (or select View | Tool Windows | Problems):
RustRover will suggest quick-fixes and intentions where possible. Quick fixes are marked with a red bulb () and address errors. Intentions are marked with a yellow bulb () and suggest possible enhancements and optimizations.
Apply a quick-fix/intention
If an inspection has detected a problem in your code, you can quickly apply a fix in the editor. Place the caret at the highlighted piece of code and press AltEnter.
Variable lifetime visualization for borrow checker errors
RustRover can visualize variable lifetimes in case the borrow checker reports an error. This may help you in locating and fixing ownership issues.
note
For this feature to work, make sure on-the-fly linter analysis is turned on: go to Settings | Rust | External Linters and set the Run external linter on the fly checkbox.
Also, the Inline problem explanations setting must be enabled in Settings | Editor | Inlay hints | Other | Rust (it is enabled by default).
Place the caret at the highlighted code or hover over it – the variable lifetime will be marked with a vertical blue line on the left and a pair of comments on the right.
Enable (or disable) Rustfmt instead of the built-in formatter
Open settings by pressing CtrlAlt0S and navigate to Rust | Rustfmt.
To enable Rustfmt, set the Use Rustfmt instead of built-in formatter checkbox. To disable Rustfmt, clear the checkbox.
note
Note that, when Rustfmt is enabled, RustRover will only use it for formatting whole files and Cargo projects. For code fragments, groups of files, and directories, RustRover will automatically switch to the built-in formatter.
Click OK to apply the changes.
Reformat a file
Open the file you want to reformat in the editor.
Press CtrlAltShift0L or select Code | Reformat File.
In the Reformat File dialog, select additional options if necessary and click Run.
The Cargo tool windowCargo tool window is designed to help you with Cargo tasks. By default, it is pinned to the tool windows bar. You can show or hide it by clicking the window indicator on the sidebar (alternatively, select View | Tool Windows | Cargo from the main menu).
You can share your code in Rust Playground without leaving the editor.
Share in Playground
Select the code fragment you'd like to share (otherwise, the IDE will copy the whole file).
Right-click and choose Rust | Share in Playground.
RustRover will create a GitHub Gist and display a notification popup with a link to the playground.
Gif
3. Build and run
Use the Build action to compile your code and Run to execute it. There are several ways to perform these actions:
Build/run Rust code
To build or run a particular target, open the Cargo tool window (View | Tool Windows | Cargo) and double-click the target.
To run from a particular entry point, locate it in the editor, click in the gutter, and select Run:
To run a particular file or module, open the Project view, right-click the necessary file or module, and select Run:
If you want to build or run code using a predefined configuration (with custom parameters and settings), select it in the switcher on the main toolbar and:
To start debugging from a particular entry point, locate it in the editor, click in the gutter, and select Debug:
To debug code using a predefined configuration (with custom parameters and settings), select it in the configuration switcher on the main toolbar and click :
RustRover allows you to explore code coverage statistics.
Run with Code Coverage
To get code coverage statistics, do one of the following:
Locate the desired entry point, click in the gutter, and select Run with Coverage:
Locate the necessary file in Project view, right-click, and select Run with Coverage:
If you want to run a predefined configuration (with custom parameters and settings), select it in the switcher on the main toolbar, then press and select Run with Coverage:
The Coverage tool window (View | Tool Windows | Coverage) will open, automatically displaying the results: