rust-doctor
Rules

Framework Rules

Rules for detecting framework-specific anti-patterns in tokio, axum, and actix-web.

These rules are conditionally enabled based on your project's dependencies. If your Cargo.toml doesn't list the relevant framework, these rules are skipped.

tokio-main-missing

Severity: Error

Detects async fn main() without the #[tokio::main] attribute. The async main function won't execute without a runtime.

// Bad
async fn main() {
    server::start().await;
}

// Good
#[tokio::main]
async fn main() {
    server::start().await;
}

tokio-spawn-without-move

Severity: Warning

Detects tokio::spawn() closures that capture references without move. This can cause lifetime errors or subtle bugs.

axum-handler-not-async

Severity: Warning

Detects axum handler functions that are not async. Axum handlers should be async to avoid blocking the runtime.

actix-blocking-handler

Severity: Error

Detects blocking operations inside actix-web handler functions. Use web::block() or spawn_blocking() for CPU-intensive work.

On this page