rust-doctor

Getting Started

Scan Rust projects for security, performance, correctness, architecture, and dependency issues with a single command.

What is rust-doctor?

rust-doctor is a unified code health tool for Rust. It scans your codebase for security vulnerabilities, performance anti-patterns, correctness bugs, architectural issues, and dependency problems — producing a 0–100 health score with actionable diagnostics.

Quick start

Run it on any Rust project without installing anything:

npx -y rust-doctor@latest .

Or install it globally:

cargo install rust-doctor

Or set up AI agent integration (Claude Code, Cursor, Windsurf):

rust-doctor setup

What does it check?

CategoryWhat it detectsSources
SecurityHardcoded secrets, SQL injection risks, unsafe block audit, known CVEsCustom AST rules + cargo-audit
PerformanceExcessive cloning, unnecessary allocations, blocking in async, collect-then-iterateCustom AST rules + clippy
CorrectnessUnwrap in production, panic in libraries, error handling anti-patternsCustom AST rules + clippy
ArchitectureFramework anti-patterns for tokio/axum/actix-web, large enum variantsCustom AST rules
DependenciesKnown vulnerabilities, license violations, unused dependencies, semver breaking changescargo-audit, cargo-deny, cargo-machete, cargo-semver-checks

How the score works

The health score is a weighted average across 5 dimensions (Security ×2.0, Reliability ×1.5, Maintainability ×1.0, Performance ×1.0, Dependencies ×1.0). Each dimension starts at 100 and subtracts penalties for each unique rule violated:

  • Error-level violation: -1.5 points
  • Warning-level violation: -0.75 points
  • Info-level violation: -0.25 points

The overall score is the weighted average of all dimension scores, clamped to [0, 100]. Fixing all instances of one rule removes the entire penalty for that rule.

ScoreLabelMeaning
75–100GreatHealthy codebase
50–74Needs workAccumulated technical debt
0–49CriticalSignificant issues to address

On this page