fix: drop useless .into_iter() on chain arg in synced sftp session#205
Merged
Conversation
CI on rustc 1.95 fails `cargo clippy -- -D warnings` with `clippy::useless_conversion` on `client/session.rs:194` because `Iterator::chain` already accepts any `IntoIterator`, so the explicit `.chain(files.into_iter())` is redundant. The lint did not exist (or was less aggressive) on rustc 1.93 where PR #203 was developed, so the issue only surfaced after upstream toolchain bump. The line was imported verbatim from upstream russh-sftp 2.1.2 when we full-source-synced the fork in PR #203. Upstream has the same lint waiting to fire whenever they bump their MSRV / clippy. Fix is the obvious one — `.chain(files)` instead of `.chain(files.into_iter())`. Functionally identical, just lets the trait do its job. Verified locally on rustc 1.95.0 (matching CI): `cargo clippy -- -D warnings` clean, `cargo clippy --workspace --lib -- -D warnings` clean, `cargo test --lib` 1233 passed / 0 failed / 9 ignored (matches CI's `cargo test --lib --verbose` step exactly). No other `useless_conversion` hits in the workspace's lib targets under 1.95. The same change is worth filing upstream against AspectUnk/russh-sftp so future syncs don't have to re-port this; tracking that as a follow-up rather than blocking this CI fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Unbreaks CI on rustc 1.95 after PR #203's russh-sftp 2.1.2 sync. One-line fix:
Iterator::chainalready accepts anyIntoIterator, so.chain(files.into_iter())is flagged byclippy::useless_conversion(a lint that became more aggressive in 1.95). The line was imported verbatim from upstream russh-sftp 2.1.2 in PR #203, and upstream has the same lint waiting to fire whenever they bump their MSRV.Fix:
.chain(files)instead of.chain(files.into_iter()). Functionally identical, just lets theIntoIteratortrait do its job.Why we missed it locally
PR #203 was developed on rustc 1.93.1 where this particular
useless_conversioncase wasn't lint-equivalent. After bumping local toolchain to 1.95.0 viarustup update stable,cargo clippy -- -D warnings(the exact invocation CI runs from.github/workflows/ci.yml) now reproduces the failure — and after this one-line fix, comes back clean.Verification on rustc 1.95.0 (matches CI)
rustc --version→rustc 1.95.0 (59807616e 2026-04-14)cargo clippy -- -D warnings(CI's command) → cleancargo clippy --workspace --lib -- -D warnings→ cleancargo test --lib --verbose(CI's test step feat: add connection pooling infrastructure for future features #1) → 1233 passed / 0 failed / 9 ignoredNo other
useless_conversionhits in the workspace's lib targets under 1.95.Follow-up worth filing
The same change is worth filing upstream against
AspectUnk/russh-sftpso future syncs don't have to re-port this. Tracking that as a separate follow-up rather than blocking this CI fix.Test plan
rustup update stableto 1.95.0cargo clippy -- -D warnings— clean (reproduces CI invocation exactly)cargo test --lib— 1233 passedcargo fmt— applied (no changes)