Skip to content

Commit 4b006eb

Browse files
authored
Update Rust to 1.97 (#2313)
Bump the Rust toolchain to 1.97 and MSRV to 1.95, and adopt features stabilized in Rust 1.95.
1 parent 40f6609 commit 4b006eb

7 files changed

Lines changed: 19 additions & 28 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resolver = "3"
55
[workspace.package]
66
version = "0.4.8"
77
edition = "2024"
8-
rust-version = "1.94"
8+
rust-version = "1.95"
99
repository = "https://github.com/j178/prek"
1010
homepage = "https://prek.j178.dev/"
1111
license = "MIT"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ cargo binstall prek
151151

152152
<!-- --8<-- [start: cargo-install] -->
153153

154-
Build from source using Cargo (Rust 1.89+ is required):
154+
Build from source using Cargo (Rust 1.95+ is required):
155155

156156
```bash
157157
cargo install --locked prek

crates/prek/src/cli/cache_gc.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,7 @@ fn detail_lines_for_entry(
722722

723723
match kind {
724724
RemovalKind::Repos => vec![],
725-
RemovalKind::HookEnvs => {
726-
let Some(info) = hook_marker else {
727-
return Vec::new();
728-
};
729-
725+
RemovalKind::HookEnvs if let Some(info) = hook_marker => {
730726
let mut lines = Vec::new();
731727
lines.push(format!(
732728
"{}: {} ({})",

crates/prek/src/hook_entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl DirectHookEntry {
143143
pub(crate) fn split(&self) -> Result<Vec<String>, Error> {
144144
let splits = shlex::split(&self.entry).ok_or_else(|| Error::Hook {
145145
hook: self.hook.clone(),
146-
error: anyhow::anyhow!("Failed to parse entry `{}` as commands", &self.entry),
146+
error: anyhow::anyhow!("Failed to parse entry `{}` as commands", self.entry),
147147
})?;
148148
if splits.is_empty() {
149149
return Err(Error::Hook {

crates/prek/src/languages/python/uv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn validate_uv_binary(uv_path: &Path) -> Result<Version> {
111111
if !UV_VERSION_RANGE.matches(&version) {
112112
bail!(
113113
"uv version `{version}` does not satisfy required range `{}`",
114-
&*UV_VERSION_RANGE
114+
*UV_VERSION_RANGE
115115
);
116116
}
117117
Ok(version)
@@ -600,7 +600,7 @@ mod tests {
600600
assert!(
601601
UV_VERSION_RANGE.matches(&version),
602602
"CUR_UV_VERSION {CUR_UV_VERSION} does not satisfy the version requirement {}",
603-
&*UV_VERSION_RANGE
603+
*UV_VERSION_RANGE
604604
);
605605
}
606606

crates/prek/src/run.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,23 +123,18 @@ static PAGE_SIZE: LazyLock<usize> = LazyLock::new(|| {
123123
// https://github.com/uutils/findutils/blob/af48c151fe9b29cb7d25471b5388013ca15748ba/src/xargs/mod.rs#L177
124124
// https://github.com/sharkdp/argmax
125125
fn platform_max_cli_length() -> usize {
126-
#[cfg(unix)]
127-
{
128-
let mut arg_max = *ARG_MAX;
129-
// Assume arguments are counted with the granularity of a single page,
130-
// so allow a one page cushion to account for rounding up
131-
arg_max -= *PAGE_SIZE;
132-
// POSIX recommends an additional 2048 bytes of headroom
133-
arg_max -= ARG_HEADROOM;
134-
arg_max.clamp(1 << 12, 1 << 20)
135-
}
136-
#[cfg(windows)]
137-
{
138-
(1 << 15) - ARG_HEADROOM // UNICODE_STRING max - headroom
139-
}
140-
#[cfg(not(any(unix, windows)))]
141-
{
142-
1 << 12
126+
cfg_select! {
127+
unix => {
128+
let mut arg_max = *ARG_MAX;
129+
// Assume arguments are counted with the granularity of a single page,
130+
// so allow a one page cushion to account for rounding up
131+
arg_max -= *PAGE_SIZE;
132+
// POSIX recommends an additional 2048 bytes of headroom
133+
arg_max -= ARG_HEADROOM;
134+
arg_max.clamp(1 << 12, 1 << 20)
135+
},
136+
windows => (1 << 15) - ARG_HEADROOM, // UNICODE_STRING max - headroom
137+
_ => 1 << 12,
143138
}
144139
}
145140

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "1.96"
2+
channel = "1.97"

0 commit comments

Comments
 (0)