I'm tinkering with a project, right now, which compiles fine with stable rust, but its rustfmt configuration uses a whole bunch of options that are only available with nightly rustfmt. I don't want to switch my default toolchain to nightly just for the sake of this project. It would be nice if it were possible to specify, in .pre-commit-config.yaml for this project, that the fmt hook should run cargo +nightly fmt instead of cargo fmt.
This doesn't appear to be possible with the args array because that's inserted too late on the command line, e.g.
hooks:
- id: fmt
args: ["+nightly"]
gives an error message about there not being any file named +nightly.
I'm tinkering with a project, right now, which compiles fine with stable rust, but its rustfmt configuration uses a whole bunch of options that are only available with nightly rustfmt. I don't want to switch my default toolchain to nightly just for the sake of this project. It would be nice if it were possible to specify, in
.pre-commit-config.yamlfor this project, that the fmt hook should runcargo +nightly fmtinstead ofcargo fmt.This doesn't appear to be possible with the args array because that's inserted too late on the command line, e.g.
gives an error message about there not being any file named
+nightly.