Skip to content

Instantly share code, notes, and snippets.

@thkprado
Last active March 16, 2021 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thkprado/be9e1fd3dad120405a2ff6d0b6bd7e82 to your computer and use it in GitHub Desktop.
Save thkprado/be9e1fd3dad120405a2ff6d0b6bd7e82 to your computer and use it in GitHub Desktop.
Install Rust:
$ sudo apt-get install libc-dev
$ curl https://sh.rustup.rs -sSf | sh
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Update Rust:
$ rustup self update
$ rustup update
Rust is distributed on three different release channels:
stable, beta, and nightly.
rustup nightly:
Install:
$ rustup install nightly
Test rustup nightly:
$ rustup run nightly rustc --version
Switch to nightly globally:
$ rustup default nightly
Cargo:
$ cargo +nightly test
Compiling and Running (without Cargo):
$ rustc main.rs
$ ./main
Cargo:
Creating a Project:
$ cargo new hello_cargo --bin
$ cd hello_cargo
Building and Running a Project:
$ cargo build
$ ./target/debug/hello_cargo
$ cargo run
Building for Release:
$ cargo build --release
$ ./target/release/hello_cargo
Cargo as Convention:
$ git clone someurl.com/someproject
$ cd someproject
$ cargo build
cargo clippy as a subcommand:
# $ cargo +nightly install clippy
# $ cargo +nightly clippy
rustup update
rustup component add clippy
cargo clippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment