
Rustfmt Configuration and Formatting Checks in CI Explained
Format Rust code the same way everywhere with rustfmt: the few settings worth changing, the nightly-only options to avoid, and a CI check that fails on unformatted code.
Everything you need to level up your coding skills.

Format Rust code the same way everywhere with rustfmt: the few settings worth changing, the nightly-only options to avoid, and a CI check that fails on unformatted code.

Neovim talks to rust-analyzer through its built-in LSP client. A short config gives completion, diagnostics, formatting and Treesitter highlighting, and rustaceanvim adds Rust extras.

A one-page runbook for when a Rust service misbehaves: stabilize first, check recent changes, read the four golden signals, find the failing dependency, and use the Rust-specific evidence: panics, memory, executor stalls.

A hung async service has no useful thread backtrace. Tokio task dumps capture the await stack of every task. Enable tokio_unstable and taskdump, trigger a dump from a signal or endpoint, and read where each task is parked.

Os error 24 means the process hit its file descriptor limit. Check the limit and the live count, find the leak or the missing bound, raise the limit in systemd, Docker or code, and cap concurrency so it stays low.

Connection refused means nothing was listening at that address and port. Check the bind address, localhost versus 127.0.0.1, containers and Docker networks, startup order and the wrong port, with commands for each.

Find where a Rust program allocates and how much it holds. Use /usr/bin/time for peak RSS, heaptrack for Linux allocation timelines, the dhat crate for portable heap profiles and a counting allocator for tests.

cargo update moves within your version ranges; cargo outdated shows what is beyond them; cargo upgrade and cargo update --breaking edit the ranges themselves. Learn the safe routine for each.

A task that hangs forever has a short list of causes: a channel sender that never drops, an await on a lock held across an await, a blocked worker, a missing timeout, or a lost wake-up.

tokio-console shows every task, how long it has been idle or busy, and which ones never wake up. Set it up with console-subscriber and read the columns that expose stuck and blocking tasks.

Logs leak more secrets than breaches: derived Debug, request headers, URLs, SQL parameters and error chains. Use secrecy, custom Debug, tracing skip and filters to stop it.

What belongs in .gitignore for a Rust project, why Cargo.lock is committed for binaries, and what to keep out of the repository: target, secrets, editor files and local config.
We send one email when a new post is published. No spam.