Skip to content

chore(backend): return a ready future from the composite exchange test mock - #13994

Merged
AntonioVentilii merged 4 commits into
mainfrom
av/backend-unused-async-trait-impl
Sep 10, 2026
Merged

chore(backend): return a ready future from the composite exchange test mock#13994
AntonioVentilii merged 4 commits into
mainfrom
av/backend-unused-async-trait-impl

Conversation

@AntonioVentilii

Copy link
Copy Markdown
Collaborator

Motivation

Rust 1.98 adds clippy::unused_async_trait_impl, which fires on an async fn in a trait impl whose body contains no .await. The backend lint job runs with -D warnings, so it becomes a hard error:

error: unused `async` for async trait impl function with no `.await` statements
  --> src/backend/src/exchange/composite.rs:109:9
error: could not compile `backend` (lib test) due to 1 previous error

This is the only occurrence in the repo. PanickingPrimaryProvider::fetch_prices right below it is exempt because its body diverges on panic!.

It currently blocks the toolchain bump in #13776, which fails on nothing else. Landing it separately keeps that PR a pure dependabot bump.

Changes

MockPrimaryProvider::fetch_prices is a plain fn returning impl Future and wraps its value in std::future::ready, which is the form clippy suggests. Implementing a trait's async fn this way is allowed, and it compiles on 1.97.1 as well, so this does not depend on the bump landing first.

Tests

  • cargo test -p backend --lib exchange::composite: 8 passed, 0 failed.
  • ./scripts/lint.rust.sh: clean.

Both on the pinned 1.97.1. The 1.98 lint itself is verified by CI on #13776 once this is merged and that branch rebases.

…t mock

Rust 1.98 adds clippy::unused_async_trait_impl, which fires on an async trait impl with no .await in its body. With -D warnings this fails the backend lint job.
@AntonioVentilii
AntonioVentilii requested a review from a team as a code owner September 9, 2026 09:24
Copilot AI lite review requested due to automatic review settings September 9, 2026 09:24
@zeropath-ai

zeropath-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 1cffb63.

Security Overview
Detected Code Changes
Change Type Relevant files
Refactor ► src/backend/src/exchange/composite.rs
    Modify test utilities imports to include future::Future and ready, and rc::Rc; adjust fetch_prices: from async fn to fn returning impl Future, using ready(...) to wrap result

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped to test-only code, matches the trait’s desugared async signature, and should resolve the Rust 1.98 clippy failure without affecting runtime behavior.

Pull request overview

Adjusts the exchange::composite unit-test mock to avoid Rust 1.98’s new clippy::unused_async_trait_impl lint (which becomes a hard error under -D warnings), keeping the backend lint gate green during the toolchain bump.

Changes:

  • Updates MockPrimaryProvider::fetch_prices to return a ready future (std::future::ready(...)) instead of using an async fn body with no .await.
  • Updates test-module imports to include std::future::{ready, Future}.
File summaries
File Description
src/backend/src/exchange/composite.rs Updates the test mock provider implementation to return an immediately-ready future and avoid the new clippy lint.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@AntonioVentilii
AntonioVentilii added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit 865834f Sep 10, 2026
81 checks passed
@AntonioVentilii
AntonioVentilii deleted the av/backend-unused-async-trait-impl branch September 10, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants