The Rust compiler (rustc), the build and package manager (cargo) and other tools can be installed and managed using the rustup script
Installing: https://www.rust-lang.org/tools/install
- on Linux/MacOS:
curl https://sh.rustup.rs -sSf | sh
- on Windows: Download and run rustup and follow the instructions
Updating to the latest version:
rustup update
Verifying the installed version:
rustc --version
cargo --version
Various IDEs/text editors can be used to edit Rust source files.
We recommend using Visual Studio Code
Install the rust-analyzer extension. It provides:
- code completion
- jump to definition, peek definition, find all references, symbol search
- types and documentation on hover
- code formatting
- refactoring (rename, deglob)
- error squiggles and apply suggestions from errors
- snippets
- build tasks
Other useful extensions:
- Even Better TOML
- Bracket Pair Colorizer
A tool for formatting Rust code.
Documentation can be found here
Run in the current directory:
cargo fmt
This is the default supported autoformatter when using rust-analyzer from VSCode.
A tool for static checking Rust code using various lints.
Documentation can be found here
Run in the current directory:
cargo clippy