Add the rustflags configuration to your .cargo/config.toml to instruct the compiler to use mold or lld as the linker. For mold on Linux, add the following block to your config file:
[target.'cfg(target_os = "linux")']
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
For lld, replace mold with lld in the flag value. This change applies to all builds in the current workspace and significantly reduces linking time by using a faster alternative to the default system linker.