When nearing the last step of compiling a Rust project, Rust uses 1 CPU. Up until then, it uses all available CPUs. I think it's linking all the different libraries together to build the final executable.
By default, Rust uses the linker provided by the platform, so it does not control how that process proceeds. Depending on your OS, there may be a faster third-party linker that you can use.
In particular, mold as a linker and sccache as a general compilation cache can substantially improve things, but I'm not sure if mold will work on macOS and it certainly won't work on Windows.