Skip to content

bacon - Background Rust Code Checker Cheatsheet

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

MethodCommand
Cargocargo install --locked bacon
macOS (Homebrew)brew install bacon
Arch Linuxpacman -S bacon
Verifybacon --version

Running

CommandDescription
baconDefault job (usually check)
bacon clippyRun clippy on changes
bacon testRun tests on changes
bacon check-allCheck all targets/features
bacon docBuild docs
bacon --job clippy-allNamed job
bacon -- --features xPass extra cargo args

Keyboard Controls

KeyAction
cSwitch to check
lSwitch to clippy
tSwitch to test
dBuild docs
escBack to the previous job
q / Ctrl+CQuit
spaceRe-run now
sToggle summary mode (compact list)
wToggle wrapping
g/GScroll to top/bottom
pToggle 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"
FieldPurpose
default_jobWhat bacon runs with no args
commandThe actual command to run
need_stdoutCapture stdout (tests) vs stderr only (check)
watchExtra paths to watch
keybindingsCustom 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?

Aspectbaconcargo-watch
OutputCompact, in-place summaryRaw scrolling output
Job switchingLive keybindingsRestart with new args
FocusFirst error highlightedFull log
Best forContinuous feedback paneGeneric command watching

For non-Rust or generic file-watching, use watchexec; for faster test runs pair with cargo-nextest.

Resources