Rust
Tools
rustup
: rust installer and update managerrustc
: rust compilercargo
: rust build system and package managercargo clippy
: rust code lintercargo fmt
: rust code formatter
Directories
~/.rustup
: rustup metadata and toolchains~/.cargo
: cargo home directory~/.cargo/bin
: rust commands directory
Configuration
Add rust tools bin
directory to shell path
Help Docs
Open local rust docs
Rust Compiler
Compile rust file
Run compiled file
Rustup
Show current configured version and check for available updates
Update rust toolchains and rustup
Cargo
Show cargo version
Create new cargo project
Add dependency (then install dependency via cargo build
)
Update cargo crate dependencies to latest semver minor release versions (major version bumps require editing cargo.toml
)
Check package and dependencies for errors
Build project (--release
or -r
for release mode with build optimisations)
Execute generated binary to run debug or release build app
Build and run project (in single step)
Run tests and benchmarking
Document project (creates local docs for project and all dependencies)
Publish library to crates.io
VS Code
Extension: rust-analyzer
Format code: SHIFT + OPTION + F (can also be configured to format on save / paste)
Clippy
Run clippy (rust linter) on project
Automatically fix linter issues that have known resolutions
Last updated