Summary
I've recently migrated from pre-commit to prek, and had the surprise of having a hook failing because of nightly lint.
As traces confirmed it:
2026-04-20T22:00:29.268022Z TRACE Found matching system rust name=nightly-aarch64-apple-darwin
2026-04-20T22:00:29.268045Z TRACE Using system rust rust=/Users/jope/.rustup/toolchains/[email protected]
It is probably caused by the following lines:
|
let installed = toolchains |
|
.into_iter() |
|
.sorted_unstable_by(|a, b| b.version.cmp(&a.version)); |
Versions are sorted in reverse order (should use
sort_by_key and
std::cmp::Reverse btw), and nightly has obviously the greater version.
I think this behavior is quite unexpected (and nightly lints are have caused a lot of troubles). I would expect system to use the same version as the project.
Willing to submit a PR?
Platform
Darwin 25.4.0 arm64
Version
prek 0.3.9 (3a9b9fe 2026-04-13)
.pre-commit-config.yaml
[[repos]]
repo = "local"
[[repos.hooks]]
id = "fmt"
name = "fmt"
entry = "cargo fmt -- --config \"unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate,format_code_in_doc_comments=true\""
language = "rust"
pass_filenames = false
types_or = ["rust", "toml"]
[[repos.hooks]]
id = "clippy-no-default-features"
name = "clippy-no-default-features"
entry = "cargo clippy --no-default-features --all-targets -- -D warnings"
language = "rust"
pass_filenames = false
types_or = ["rust", "toml"]
Log file
2026-04-20T22:00:29.268022Z TRACE Found matching system rust name=nightly-aarch64-apple-darwin
2026-04-20T22:00:29.268045Z TRACE Using system rust rust=/Users/jope/.rustup/toolchains/[email protected]
Summary
I've recently migrated from pre-commit to prek, and had the surprise of having a hook failing because of nightly lint.
As traces confirmed it:
It is probably caused by the following lines:
prek/crates/prek/src/languages/rust/installer.rs
Lines 144 to 146 in fba1c85
Versions are sorted in reverse order (should use
sort_by_keyandstd::cmp::Reversebtw), and nightly has obviously the greater version.I think this behavior is quite unexpected (and nightly lints are have caused a lot of troubles). I would expect system to use the same version as the project.
Willing to submit a PR?
Platform
Darwin 25.4.0 arm64
Version
prek 0.3.9 (3a9b9fe 2026-04-13)
.pre-commit-config.yaml
Log file