January 2019
Intermediate to advanced
520 pages
14h 32m
English
To use clippy, it's enough to start it as the subcommand of cargo:
cargo clippy
This sub-command starts checking the code and will inform you about possible improvements. For example, imagine that you have a struct like this in your code:
struct State { vec: Box<Vec<u8>>,}
Then, clippy will inform you that Box is unnecessary, since Vec is already placed in a memory heap:
warning: you seem to be trying to use `Box<Vec<T>>`. Consider using just `Vec<T>` --> src/main.rs:4:10 |4 | vec: Box<Vec<u8>>, | ^^^^^^^^^^^^ | = note: #[warn(clippy::box_vec)] on by default = help: `Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation. = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#box_vec ...
Read now
Unlock full access