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
maximal_features = true
aggregate_targets = true
no_targets = true
install_missing_targets = true
only_packages_with_lib_target = true
omit_host_target_flag = falsededupe = trueimplies diagnostics-only output.prune_implied = falseturns off automatic pruning.maximal_features = trueruns only maximal feature sets, resolved per package-target like every other flag.omit_host_target_flagis the one key that defaults totrue; set it tofalseto inject--targetfor the host too.no_targetsfrom config never lifts the package-leveltargetsfilter for an explicit--target; only the command-line--no-targetsforces that.
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#
- Any default configured here can be turned back off for one invocation with an inline value on the matching CLI flag:
--summary-only=false,--dedupe=off,--omit-host-target-flag=0. See the CLI reference. verbosecan also be set with theCARGO_FC_VERBOSEenvironment variable (see the CLI reference).--envand--unset-envoverride the resolved child-process environment; they are value options rather than boolean flag defaults.