Skip to content

sim: replace deprecated rand 0.9 APIs#2715

Open
d3zd3z wants to merge 1 commit intomcu-tools:mainfrom
d3zd3z:fix-rand-deprecation
Open

sim: replace deprecated rand 0.9 APIs#2715
d3zd3z wants to merge 1 commit intomcu-tools:mainfrom
d3zd3z:fix-rand-deprecation

Conversation

@d3zd3z
Copy link
Copy Markdown
Member

@d3zd3z d3zd3z commented Apr 26, 2026

Summary

  • Replace rand::thread_rng() with rand::rng() and Rng::gen_range with Rng::random_range in sim/src/image.rs — both were renamed in rand 0.9 and now emit deprecation warnings after the recent dependabot bump from 0.8.5 to 0.9.3.
  • No behavioral change; the new names are direct renames.

Test plan

  • cargo build (in repo root) is warning-free apart from the pre-existing C-side ranlib: ... has no symbols notes.
  • CI passes the existing simulator matrix.

`rand::thread_rng` was renamed to `rand::rng`, and `Rng::gen_range`
to `Rng::random_range`, in rand 0.9. The simulator pinned to 0.9 in
a recent dependabot bump, so the old names now emit deprecation
warnings.

Signed-off-by: David Brown <david.brown@linaro.org>
Assisted-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates simulator image logic to use the non-deprecated rand 0.9 APIs, eliminating deprecation warnings after the dependency bump from rand 0.8.x to 0.9.x.

Changes:

  • Replace rand::thread_rng() with rand::rng()
  • Replace Rng::gen_range(...) with Rng::random_range(...)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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