Rust
TL;DR
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.bashrc
rustc --version
cargo --version
Rustup Install
Install rustup
Latest version of rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
case "$SHELL" in
*/zsh) source ~/.zshrc ;;
*/bash) source ~/.bashrc ;;
esac
Check version
rustc --version
cargo --version
rustup --version
Manage toolchains
List installed toolchains
rustup toolchain list
Install a toolchain
rustup toolchain install stable
rustup toolchain install nightly
Set default toolchain
rustup default stable
Update toolchains
rustup update
Components and targets
Add a component
rustup component add clippy
rustup component add rustfmt
Add a target
rustup target add wasm32-unknown-unknown
Cargo basics
Create a new project
cargo new <project>
Build and run
cargo build
cargo run
Format and lint
cargo fmt
cargo clippy
Uninstall rust
Uninstall rustup and toolchains
rustup self uninstall