bacon - Background Rust Code Checker Cheatsheet
bacon is a background code checker for Rust. You run it once in a side terminal and it watches your source files, rerunning cargo check, clippy, or your tests on every save and displaying a compact, always-current summary of errors and warnings. The design goal is that you never type cargo check again and never scroll through walls of output — bacon shows the first error prominently and updates in place as you fix things.
Installation
| Method | Command |
|---|
| Cargo | cargo install --locked bacon |
| macOS (Homebrew) | brew install bacon |
| Arch Linux | pacman -S bacon |
| Verify | bacon --version |
Running
| Command | Description |
|---|
bacon | Default job (usually check) |
bacon clippy | Run clippy on changes |
bacon test | Run tests on changes |
bacon check-all | Check all targets/features |
bacon doc | Build docs |
bacon --job clippy-all | Named job |
bacon -- --features x | Pass extra cargo args |
Keyboard Controls
| Key | Action |
|---|
c | Switch to check |
l | Switch to clippy |
t | Switch to test |
d | Build docs |
esc | Back to the previous job |
q / Ctrl+C | Quit |
space | Re-run now |
s | Toggle summary mode (compact list) |
w | Toggle wrapping |
g/G | Scroll to top/bottom |
p | Toggle pause on changes |
Summary Mode
Summary mode collapses output into one line per problem — ideal for a narrow side pane.
✖ 3 errors · ⚠ 5 warnings
src/main.rs:42 mismatched types
src/lib.rs:17 unused variable: `x`
Press s to toggle; press enter on an entry to expand the full diagnostic.
Configuration
# bacon.toml in the project root
default_job = "clippy"
[jobs.clippy]
command = ["cargo", "clippy", "--all-targets", "--color", "always"]
need_stdout = false
[jobs.test]
command = ["cargo", "nextest", "run", "--color", "always"]
need_stdout = true
[jobs.check-win]
command = ["cargo", "check", "--target", "x86_64-pc-windows-msvc"]
[keybindings]
n = "job:check-win"
| Field | Purpose |
|---|
default_job | What bacon runs with no args |
command | The actual command to run |
need_stdout | Capture stdout (tests) vs stderr only (check) |
watch | Extra paths to watch |
keybindings | Custom keys to switch jobs |
Common Setups
# Two-pane workflow: editor on the left, bacon on the right
bacon clippy
# Run tests continuously with nextest for speed
bacon test # with the nextest job defined above
# Watch a workspace member only
bacon -p my-crate
Why Not Just cargo watch?
| Aspect | bacon | cargo-watch |
|---|
| Output | Compact, in-place summary | Raw scrolling output |
| Job switching | Live keybindings | Restart with new args |
| Focus | First error highlighted | Full log |
| Best for | Continuous feedback pane | Generic command watching |
For non-Rust or generic file-watching, use watchexec; for faster test runs pair with cargo-nextest.
Resources