# Clippy * Lint-plugin for Rust * Started by Manish Goregaokar with 5 Lints * I merged my `extra_lints` project, added more lints * currently over 70 lints and growing
# Motivation * Improve Code in general * Attention vs. Compiler Checks * "Don't fix bugs, fix *classes of bugs*"
# Installation * needs nightly (alas) * `[dev-dependencies]` (let Cargo do it) * `git clone https://github.com/Manishearth/rust-clippy && cd rust-clippy && cargo build --release`
# Configuration * `#![plugin(clippy)]` * `#[allow(..)]` * `#[warn(..)]` * `#[deny(..)]`
# Execution * `[dev-dependencies]` + `#[plugin(clippy)]`: `cargo build` * All other Code: `cargo rustc -- -L ../rust-clippy/target/release -Z extra-plugins=clippy` * Configuration via `-A ..` / `-W ..` / `-D ..`
# Case Study 1: clippy * About 4500 LOC * `util/dogfood.sh`: clippy vs. clippy * False positives in `eta_reduction` (fixed) * 4×`len_zero`, 3×`needless_return`, 5×`single_match`
# Case study 2: Servo * About a freakazillion LOC * Manish Goregaokar's servo-clippy branch
matches|Lint -------|-------------------- 200 |needless_lifetimes 62 |single_match 45 |needless_return 23 |toplevel_ref_arg 21 |linkedlist 12 |redundant_closure 8 |let_and_return 4 |needless_range_loop 2 |string_to_string 2 |box_vec
# Case study 3: Rustc + `std` * Around 250.000 LOC * Build-System hackery * Multirust (very cool!)
matches |Lint --------|------------------ 167 |str_to_string 102 |needless_lifetimes 71 |needless_return 13 |type_complexity 10 |match_ref_pats 5 |precedence 4 |single_match 4 |redundant_closure 3 |let_and_return 3 |collapsible_if
# Interna * EarlyLintPass vs. LateLintPass * compile-test * Automation
# Let clippy check your Code!