RustRover 2023.2 Help

Working with TOML files

In Rust, the TOML format is used to write package manifests – Cargo.toml files. For more information about the TOML format, check out the Cargo book. Below you will find the main features for working with TOML files in RustRover.

Highlighting and code style

The highlighting and code style settings are applied to .toml files automatically. You can adjust the settings in Settings | Editor | Color Scheme (or Code Style) | TOML.

Code completion

Code completion works for most manifest keys and Cargo features. You can also autocomplete local dependency paths and navigate to the source via click:

Code insight for paths in Cargo.toml

When specifying dependencies from crates.io, you can autocomplete their names and versions:

Completion for names and versions of dependencies from crates.io

You can navigate across Cargo features and jump to feature declarations from cfg and cfg_attr attributes:

Completion and navigation for Cargo features

Inspections

The IDE runs a number of inspections to verify Cargo.toml. It checks whether the referenced crates exist and whether their versions are up-to-date. It also detects any cyclic feature dependencies.

Most problems can be fixed in one click: press Alt+Enter to view the options.

Updating crate version with quick fix

Enabling and disabling features

There's a smart UI for enabling/disabling specific features of your workspace right in the Cargo.toml file. It affects name resolution and code insight across the entire project.

Toggling Cargo features

View crate documentation

You will see a docs.rs gutter icon next to each extern crate declaration – you can use it to quickly open the crates.io description of the crate in your browser:

Opening docs.rs from Cargo.toml
Last modified: 08 September 2023