Ben Chuanlong Du's Blog

It is never too late to learn.

Tips on Rust

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

https://lib.rs/

Rust Blessed is an unofficial guide to the Rust ecosystem.

Installation

Please refer to Tips on rustup for installing Rust using rustup (the recommended way for most users …

Benchmark a Rust App

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Tips and Traps

  1. The built-in benchmarking is still unstable and will likely be deprecated.

  2. criterion is currently the best Rust crate for benchmarking.

Criterion

  1. With Rust stable, Criterion can only benchmark …

Tips on Rust Clippy

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

unused_variables unused_imports dead_code

General Tips

  1. Clippy does not support filtering by specific lint directly. However, it can be achieved via the old rustc flags hack. For example, you can use the …

Unit Test in Rust

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

https://crates.io/crates/test-with

Tips and Traps

  1. std::assert! and std::assert_eq! can be used to assert whether certain conditions are met. They are typically used for testing but they …