I had no idea there were short forms of the major cargo commands. Turns out all of:
cargo b
(build)cargo c
(check)cargo d
(doc)cargo r
(run)cargo t
(test)exist. Been typing the whole command like a prat over here.
Also, someone on the Bevy discord kindly pointed out that I could stop configuring each and every
project with the same Cargo linking and static generation options, since it accepts configuration at
system level. So if you're using mold
and cranelift
on Linux:
[profile.dev]
codegen-backend = "cranelift"
[profile.dev.package."*"]
codegen-backend = "llvm"
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
"-Clink-arg=-fuse-ld=/usr/local/bin/mold",
# Nightly
"-Zshare-generics=y",
"-Zthreads=0",
]
[target.x86_64-apple-darwin]
rustflags = []
[target.aarch64-apple-darwin]
rustflags = []
[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
rustdocflags = ["-Clinker=rust-lld.exe"]
rustflags = []
[unstable]
codegen-backend = true
in ~/.cargo/config.toml
will do the trick.
As aevyrie points out, you can even add aliases:
[alias]
serve = "run --target wasm32-unknown-unknown"
wdoc = "watch -s 'cargo doc && http target/doc'"
re = "run --example"
rer = "run --release --example"
It's like its own little shell environment.