Skip to content

fix: drop useless .into_iter() on chain arg in synced sftp session#205

Merged
inureyes merged 1 commit into
mainfrom
fix/sftp-useless-conversion-rust-1.95
May 18, 2026
Merged

fix: drop useless .into_iter() on chain arg in synced sftp session#205
inureyes merged 1 commit into
mainfrom
fix/sftp-useless-conversion-rust-1.95

Conversation

@inureyes
Copy link
Copy Markdown
Member

Summary

Unbreaks CI on rustc 1.95 after PR #203's russh-sftp 2.1.2 sync. One-line fix: Iterator::chain already accepts any IntoIterator, so .chain(files.into_iter()) is flagged by clippy::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.

error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   --> crates/bssh-russh-sftp/src/client/session.rs:194:32
    |
194 |                         .chain(files.into_iter())
    |                                ^^^^^^^^^^^^^^^^^

Fix: .chain(files) instead of .chain(files.into_iter()). Functionally identical, just lets the IntoIterator trait do its job.

Why we missed it locally

PR #203 was developed on rustc 1.93.1 where this particular useless_conversion case wasn't lint-equivalent. After bumping local toolchain to 1.95.0 via rustup 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)

No other useless_conversion hits in the workspace's lib targets under 1.95.

Follow-up worth filing

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 separate follow-up rather than blocking this CI fix.

Test plan

  • rustup update stable to 1.95.0
  • cargo clippy -- -D warnings — clean (reproduces CI invocation exactly)
  • cargo test --lib — 1233 passed
  • cargo fmt — applied (no changes)

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.
@inureyes inureyes added type:bug Something isn't working status:review Under review priority:high High priority issue labels May 18, 2026
@inureyes inureyes merged commit 2bcf3fc into main May 18, 2026
1 check passed
@inureyes inureyes deleted the fix/sftp-useless-conversion-rust-1.95 branch May 18, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:high High priority issue status:review Under review type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant