Zero-dependency Rust: why I stopped reaching for crates
Every dependency is a promise you'll maintain it. A year of zero-dep taught me to write less, ship safer...
~/notes · a programmer's notebook
software engineer · rust & go · writing about systems, craft and the joy of deleting code
01 — posts
Every dependency is a promise you'll maintain it. A year of zero-dep taught me to write less, ship safer...
Unsafe pointers, page faults and the kernel's quiet opinion about your memory. A tour through the dark corner...
125 lines, zero plugins I don't understand. The config that made my editor boring — and that's the point...
A million goroutines is a flex. Knowing when to reach for a worker pool is engineering. Measuring is both...
02 — featured
2026-02-11 · rust · 6 min
This week I deleted the last external crate from a small service. The Cargo.toml went from 14 lines of dependencies to one line of metadata. Nothing broke. The tests got faster. The binary got smaller.
Here's the pattern I keep reaching for — a tiny, dependency-free retry helper:
use std::time::Duration;
/// Retries a fallible operation with exponential backoff.
/// Keeps the call site honest: no magic, no hidden loops.
pub fn retry<T, E, F>(mut f: F) -> Result<T, E>
where
F: FnMut() -> Result<T, E>,
{
let mut delay = Duration::from_millis(100);
loop {
match f() {
Ok(v) => return Ok(v),
Err(_) => {
std::thread::sleep(delay);
delay *= 2;
if delay > Duration::from_secs(5) { return Err(delay_err()); }
}
}
}
}
fn delay_err() -> ??? { unimplemented!("you handle the error type") }
The compiler is the only dependency I trust. Everything else gets deleted first, re-added only when the pain of reimplementation exceeds the pain of maintenance.
03 — about
I'm Ana — a software engineer who believes the best code is the code you don't write. I work in Rust and Go, care deeply about reliability, and keep a notebook of things I've learned the hard way.
— ana, est. 2019 · currently: distributed systems @ a cloud company