Skip to content

Commit 4e15a1f

Browse files
committed
chore: fix the Clippy and minimal-versions jobs on Rust 1.91
Both jobs have been red on `main` since the 1.91 toolchain reached the runners, independently of any pull request. Clippy 1.91 extended `collapsible_if` to nested `if let`, which flags 40 sites. `cargo clippy --fix` rewrites them as let-chains, but neither stable rustfmt nor nightly 1.10.0 reformats the result, so the bodies keep their pre-collapse indentation until each site is fixed by hand. That churn lands in the session and encrypted modules that most open PRs touch, so allow the lint for now next to the two allows already in `lib.rs`. Under minimal versions, `yasna`'s `num-bigint = "0.4"` resolves to 0.4.0, whose `bits().div_ceil(&u64::from(bits))` now picks the inherent `u64::div_ceil` over `Integer::div_ceil` and fails to compile. 0.4.6 switched those three call sites to UFCS, so raise the floor with a renamed optional dependency, the same way `cipher`, `ghash`, `polyval` and `universal-hash` are already pinned in this file. Verified with the CI commands: `cargo clippy` with and without `--all-features`, `cargo minimal-versions check --all-features --no-dev-deps`, `cargo fmt --check`, `cargo test --all-features`, plus the 1.89.0 `wasm32-wasip1` build and an MSRV check.
1 parent 8a51a0d commit 4e15a1f

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

russh/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ default = ["flate2", "aws-lc-rs", "rsa"]
1717
# Crypto backends: enable at least one of `aws-lc-rs` or `ring`.
1818
aws-lc-rs = ["dep:aws-lc-rs"] # Default crypto backend.
1919
async-trait = ["dep:async-trait"]
20-
legacy-ed25519-pkcs8-parser = ["yasna"]
20+
legacy-ed25519-pkcs8-parser = ["yasna", "num-bigint-04"]
2121
# Danger: 3DES cipher is insecure.
2222
des = ["dep:des"]
2323
# Danger: DSA algorithm is insecure.
@@ -63,6 +63,10 @@ md5 = "0.8"
6363
ml-kem = "0.3"
6464
module-lattice = "0.2"
6565
num-bigint = { version = "0.5", features = ["rand_0_10"] }
66+
# `yasna` accepts any num-bigint 0.4; only listed to raise the floor, because
67+
# a cargo-minimal-versions failure below 0.4.6 resolves `div_ceil` to the
68+
# inherent `u64::div_ceil` instead of `Integer::div_ceil`.
69+
num-bigint-04 = { package = "num-bigint", version = "0.4.6", optional = true }
6670
p256 = { version = "0.14", features = ["ecdh"] }
6771
p384 = { version = "0.14", features = ["ecdh"] }
6872
p521 = { version = "0.14", features = ["ecdh"] }

russh/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
clippy::indexing_slicing,
55
clippy::panic
66
)]
7-
#![allow(clippy::single_match, clippy::upper_case_acronyms)]
7+
// Rust 1.91 extended `collapsible_if` to suggest let-chains, which rustfmt
8+
// does not yet format; revisit once it does.
9+
#![allow(
10+
clippy::collapsible_if,
11+
clippy::single_match,
12+
clippy::upper_case_acronyms
13+
)]
814
#![allow(macro_expanded_macro_exports_accessed_by_absolute_paths)]
915
// length checked
1016
// Copyright 2016 Pierre-Étienne Meunier

0 commit comments

Comments
 (0)