Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update edition 2024 #1601

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ThomasFrans
Copy link
Contributor

@ThomasFrans ThomasFrans commented Mar 6, 2025

Describe your changes

Mostly followed the official migration guide, and did more builds/tests/... to make sure everything works fine after every step.

  1. Updated all dependencies
  • Ran cargo update
  • Verified all code still built fine by running various version of cargo build (with all features, without default features, for all targets, various profiles, all workspaces...)
  • Verified all tests still ran fine
  1. Update the Rust edition
  • Run cargo fix --edtion (for all features, all targets, for all workspaces...)
  • Read through the warnings. The only generated warnings were about the new drop order of temporary variables for variables with a custom implementation of Drop. The warnings mention that the new drop order is rarely a problem. Didn't change any of the code the warnings mentioned (later tests seem to suggest that everything works fine).
  • Went through the diffs. There were two more functional changes: use of the new expr_2021 and unsafe for env::set_var.
  • if let ... else ... is also changed in a lot of places to match statements. Doesn't seem to change functionality.
  • Updated Cargo.toml files to share common options across workspace members (edition, authors, license and repository). This ensures these options remain the same across workspace members during future edition updates.
  • Verified all code still built fine by running various version of cargo build (with all features, without default features, for all targets, various profiles, all workspaces...)
  • Verified all tests still ran fine
  • Verified ncspot still ran fine by logging in, navigating the UI and playing a song.
  1. Format all code with cargo fmt --all

Issue ticket number and link

/

Checklist before requesting a review

  • Documentation was updated (i.e. due to changes in keybindings, commands, etc.)
  • Changelog was updated with relevant user-facing changes (eg. not dependency updates,
    not performance improvements, etc.)

Update the Rust edition and apply changes required in the new edition.
Also update the Cargo manifests to reflect the edition change, and
ensure changes automatically apply to workspace members in the future.
The new Rust edition comes with some new formatting defaults, which need
to be applied since the edition was increased.
@ThomasFrans
Copy link
Contributor Author

Just wanted to try a Rust edition update to see how difficult or easy it is. I made a PR in case you'd like to accept this change since I now had the result of the update anyway. It was mostly for exploring this process myself, so feel free to close if you'd like to do the edition update yourself or at a later point in time 🙂

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