The Best Rust Static Analysis Tools (Linters/Formatters)
We rank 60 Rust linters, code analyzers, formatters, and more. Find and compare tools like Mega-Linter, clippy, Sonatype, and more. Please rate and review tools that you've used. This helps others find the best tools for their projects.
40 Rust Tools
Need help migrating to Rust?
corrode is a friendly consultancy that helps you make the most of Rust. We offer training, mentoring, and development services. Reach out today for expert help in developing reliable and efficient software!
rust-analyzer
Supports functionality such as 'goto definition', type inference, symbol search, reformatting, and code completion, and enables renaming and refactorings.
cargo-audit
Audit Cargo.lock for crates with security vulnerabilities reported to the RustSec Advisory Database.
cargo-bloat
Find out what takes most of the space in your executable. supports ELF (Linux, BSD), Mach-O (macOS) and PE (Windows) binaries.
cargo-expand
Cargo subcommand to show result of macro expansion and #[derive] expansion applied to the current crate. This is a wrapper around a more verbose compiler command.
cargo-spellcheck
Checks all your documentation for spelling and grammar mistakes with hunspell (ready) and languagetool (preview)
cargo udeps
Find unused dependencies in Cargo.toml. It either prints out a "unused crates" line listing the crates, or it prints out a line saying that no crates were unused.
Rust Language Server
Supports functionality such as 'goto definition', symbol search, reformatting, and code completion, and enables renaming and refactorings.
cargo-deny
A cargo plugin for linting your dependencies. It can be used either as a command line too, a Rust crate, or a Github action for CI. It checks for valid license information, duplicate crates, security vulnerabilities, and more.
cargo-inspect
Inspect Rust code without syntactic sugar to see what the compiler does behind the curtains.
electrolysis
A tool for formally verifying Rust programs by transpiling them into definitions in the Lean theorem prover.
RustViz
RustViz is a tool that generates visualizations from simple Rust programs to assist users in better understanding the Rust Lifetime and Borrowing mechanism. It generates SVG files with graphical indicators that integrate with mdbook to render visualizations of data-flow in Rust programs.
cargo-semver-checks
Scan your Rust crate releases for semver violations. It can be used either directly via the CLI, as a GitHub Action in CI, or via release managers like release-plz
. It found semver violations in more than 1 in 6 of the top 1000 most-downloaded crates on crates.io.
cargo-unused-features
Find potential unused enabled feature flags and prune them. You can generate a simple HTML report from the json to make it easier to inspect results. It removes a feature of a dependency and then compiles the project to see if it still compiles. If it does, the feature flag can possibly be removed, but it can be a false-positive.
kani
The Kani Rust Verifier is a bit-precise model checker for Rust. Kani is particularly useful for verifying unsafe code blocks in Rust, where the "unsafe superpowers" are unchecked by the compiler. Kani verifies:
- Memory safety (e.g., null pointer dereferences)
- User-specified assertions (i.e., assert!(...))
- The absence of panics (e.g., unwrap() on None values)
- The absence of some types of unexpected behavior (e.g., arithmetic overflows)
cargo-breaking
cargo-breaking compares a crate's public API between two different branches, shows what changed, and suggests the next version according to semver.
cargo-call-stack
Whole program static stack analysis The tool produces the full call graph of a program as a dot file.
cargo-geiger
A cargo plugin for analysing the usage of unsafe Rust code Provides statistical output to aid security auditing
cargo-show-asm
cargo subcommand showing the assembly, LLVM-IR and MIR generated for Rust code
rust-audit
Audit Rust binaries for known bugs or security vulnerabilities. This works by embedding data about the dependency tree (Cargo.lock) in JSON format into a dedicated linker section of the compiled executable.
cargo-careful
Execute Rust code carefully, with extra checking along the way. It builds the standard library with debug assertions. Here are some of the checks this enables:
get_unchecked
in slices performs bounds checks *copy
,copy_nonoverlapping
, andwrite_bytes
check that pointers are aligned and non-null and (if applicable) non-overlapping{NonNull,NonZero*,...}::new_unchecked
check that the value is valid * plenty of internal consistency checks in the collection types * mem::zeroed and the deprecated mem::uninitialized panic if the type does not allow that kind of initialization
20 Multi-Language Tools
Mega-Linter
Mega-Linter can handle any type of project thanks to its 70+ embedded Linters, its advanced reporting, runnable on any CI system or locally, with assisted installation and configuration, able to apply formatting and fixes
ThreatMapper
Vulnerability Scanner and Risk Evaluation for containers, serverless and hosts at runtime. ThreatMapper generates runtime BOMs from dependencies and operating system packages, matches against multiple threat feeds, scans for unprotected secrets, and scores issues based on severity and risk-of-exploit.
trivy
A Simple and Comprehensive Vulnerability Scanner for Containers and other Artifacts, Suitable for CI. Trivy detects vulnerabilities of OS packages (Alpine, RHEL, CentOS, etc.) and application dependencies (Bundler, Composer, npm, yarn, etc.). Checks containers and filesystems.
lizard
Lizard is an extensible Cyclomatic Complexity Analyzer for many programming languages including C/C++ (doesn't require all the header files or Java imports). It also does copy-paste detection (code clone detection/code duplicate detection) and many other forms of static code analysis. Counts lines of code without comments, CCN (cyclomatic complexity number), token count of functions, parameter count of functions.
allocscope
allocscope is a tool for tracking down where the most egregiously large allocations are occurring in a C, C++ or Rust codebase. It is particularly intendend to be useful for developers who want to get a handle on excessive allocations and are working in a large codebase with multiple contributors with allocations occuring in many modules or libraries.
CodeSee
CodeSee is mapping and automating your app's services, directories, file dependencies, and code changes. It's like Google Map, but for code.t
autocorrect
A linter and formatter to help you to improve copywriting, correct spaces, words, punctuations between CJK (Chinese, Japanese, Korean).
StaticReviewer
Static Reviewer executes code checks according to the most relevant Secure Coding Standards, OWASP, CWE, CVE, CVSS, MISRA, CERT, for 40+ programming languages, using 1000+ built-in validation rules for Security, Deadcode & Best Practices Available a module for Software Composition Analysis (SCA) to find vulnerabilities in open source and third party libraries.
Help make this list better
Suggest Tools
Frequently Asked Questions
What are Rust tools?
Rust is a multi-paradigm programming language focused on performance and safety, especially safe concurrency. Rust is syntactically similar to C++, and provides memory safety without using garbage collection. Rust was originally designed by Graydon Hoare at Mozilla Research, with contributions from Dave Herman, Brendan Eich, and others. The designers refined the language while writing the Servo layout or browser engine, and the Rust compiler. It has gained increasing use in industry, and Microsoft has been experimenting with the language for secure and safety-critical software components. Rust has been named the "most loved programming language" in the Stack Overflow Developer Survey every year since 2016.
What are the best Rust static analysis tools and linters?
The most popular Rust tools ranked by user votes are: Mega-Linter, clippy, Sonatype, rust-analyzer, cargo-audit.
Which Rust tools are free to use?
Tools with a free plan include trunk, CodeSee. On top of that, there are also a number of open source like Mega-Linter, clippy, Sonatype, rust-analyzer, cargo-audit, ThreatMapper, rustfmt, trunk, cargo-bloat, MIRAI.