Skip to content

fix: update rand sample_iter usage for rand 0.10 API - #1080

Open
ayushsingh82 wants to merge 2 commits into
graphprotocol:mainfrom
ayushsingh82:fix/rand-0-10-sample-iter
Open

fix: update rand sample_iter usage for rand 0.10 API#1080
ayushsingh82 wants to merge 2 commits into
graphprotocol:mainfrom
ayushsingh82:fix/rand-0-10-sample-iter

Conversation

@ayushsingh82

Copy link
Copy Markdown

Summary

The rand crate v0.10 moved sample_iter off the Rng trait and onto Distribution — it's now called as distribution.sample_iter(rng) instead of rng.sample_iter(&distribution). This currently breaks cargo clippy and cargo test on the pending rand 0.10.0 security-update PR (#1070), in indexer-tap-agent's test.rs (confirmed via CI logs on #1070) and indexer-dips's lib.rs test module (same broken pattern, not exercised by that CI job but would break on main once #1070 merges).

This PR applies the same fix pattern used in rand's own docs (calling sample_iter on the Distribution instance) in both places, and drops the now-unused Rng import.

Changes

  • crates/tap-agent/src/test.rs: generate_random_prefix() fixed
  • crates/dips/src/lib.rs: VoucherContext::random() (test-only) fixed

Test plan

  • cargo check -p indexer-tap-agent --tests — compiles clean
  • cargo check -p indexer-dips --tests — compiles clean
  • cargo fmt --check -p indexer-tap-agent -p indexer-dips — no diff
  • cargo clippy -p indexer-tap-agent -p indexer-dips --all-features --all-targets -- -A dead-code -D warnings — clean, matching CI's exact invocation

This should unblock #1070 (rand 0.10.0 [security]) once rebased on top of, or merged alongside, this fix.

renovate Bot and others added 2 commits August 6, 2026 09:36
rand 0.10 moved sample_iter from the Rng trait onto Distribution,
so it's now called as `distribution.sample_iter(rng)` instead of
`rng.sample_iter(&distribution)`. Fixes the CI compile failures on
the rand 0.10.0 dependency bump (graphprotocol#1070) in indexer-tap-agent and
indexer-dips test code.
@ayushsingh82

Copy link
Copy Markdown
Author

cc @MoonBoi9001 — saw you're active on tap-agent/dips lately. Quick heads up: rand 0.10 moved sample_iter from Rng to Distribution, which is currently breaking clippy/tests on the pending rand 0.10.0 security bump (#1070). This PR fixes the two broken call sites in tap-agent's test.rs and dips' lib.rs so that bump can land cleanly.

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.

1 participant