cargo fc flags in config#
Most cargo fc boolean flags can be set as defaults in Cargo.toml, using the flag name with _ instead of -. Explicit CLI flags still win for a single invocation.
[workspace.metadata.cargo-fc]
dedupe = true
fail_fast = true
[package.metadata.cargo-fc]
pedantic = false
[package.metadata.cargo-fc.target.'cfg(target_os = "windows")']
errors_only = true
[package.metadata.cargo-fc.target.'cfg(target_os = "windows")'.subcommands.clippy]
dedupe = false
[workspace.metadata.cargo-fc.subcommands.my-custom-cmd]
dedupe = trueConfigurable flag keys#
summary_only = true
diagnostics_only = true
dedupe = true
verbose = true
pedantic = true
errors_only = true
packages_only = true
fail_fast = true
prune_implied = true
show_pruned = true
aggregate_targets = true
no_targets = true
install_missing_targets = true
only_packages_with_lib_target = truededupe = trueimplies diagnostics-only output.prune_implied = falseturns off automatic pruning.
Precedence#
Flags resolve broad-to-narrow, with CLI flags last:
- workspace config
- matching workspace target config
- package config
- matching package target config
- explicit CLI flags
At each config level, a matching subcommands.<name> table is applied after that level’s plain flags, so command-specific defaults override broader ones. Alias config for the raw command token wins; otherwise cargo fc uses the resolved alias target.
Diagnostics safety#
Broad, config-driven diagnostics output only applies to commands where diagnostics-only mode is safe by default:
- Safe (get broad
diagnostics_only = trueanddedupe = truewhen configured): built-inbuild,check,clippy,doc, and aliases that resolve to them. - Not safe by default:
test,run, and unresolved custom commands — they aren’t reliable JSON-diagnostics commands, so broad diagnostics defaults are ignored for them (silently for well-known cargo plugins, otherwise with a warning).
To opt a non-safe command in, set the behavior in that command’s own table — subcommand-local diagnostics flags are explicit and honored even for commands that aren’t safe by default:
[workspace.metadata.cargo-fc.subcommands.my-custom-cmd]
dedupe = truededupe = true implies diagnostics_only = true; setting dedupe = true together with diagnostics_only = false is rejected as contradictory. Use diagnostics_only = false or dedupe = false in a narrower scope to override a broader default.
Notes#
- Inline values for boolean CLI flags are rejected (
--summary-only=falsefails). Configure false defaults inCargo.tomlinstead. verbosecan also be set with theCARGO_FC_VERBOSEenvironment variable (see the CLI reference).