Skip to content

Rename NextState::set_if_neq to set_if_different to resolve clashing#24676

Merged
alice-i-cecile merged 6 commits into
bevyengine:mainfrom
mansiverma897993:fix-nextstate-set-if-neq-clash
Jun 25, 2026
Merged

Rename NextState::set_if_neq to set_if_different to resolve clashing#24676
alice-i-cecile merged 6 commits into
bevyengine:mainfrom
mansiverma897993:fix-nextstate-set-if-neq-clash

Conversation

@mansiverma897993

Copy link
Copy Markdown
Contributor

Fixes #24655 by renaming NextState::set_if_neq to set_if_different to resolve clashing.

@kfc35 kfc35 added C-Bug An unexpected or incorrect behavior A-States App-level states machines labels Jun 21, 2026
@kfc35 kfc35 requested a review from mnmaita June 21, 2026 18:17
@kfc35 kfc35 added D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 21, 2026
@alice-i-cecile alice-i-cecile added the M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

@alice-i-cecile alice-i-cecile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed that this needs renaming. Needs a migration guide though.

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 21, 2026

@mnmaita mnmaita left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me (minus the missing migration guide as stated before). Thanks a lot!

Comment thread crates/bevy_state/src/state/resources.rs
/// Like [`set`](Self::set), but will not run any state transition schedules if the target state is the same as the current one.
/// If [`set`](Self::set) has already been called in the same frame with the same state, the transition schedules will be run anyways.
pub fn set_if_neq(&mut self, state: S) {
pub fn set_if_different(&mut self, state: S) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still needs a deprecated set_if_neq method that wraps this for migration ease :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@alice-i-cecile done now check at once lemme know if further changes required!!

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jun 24, 2026
@alice-i-cecile

Copy link
Copy Markdown
Member

Lovely, thank you :) Needs formatting then this is good to go.

I wanted to be extra paranoid about the migration because I didn't want it quietly falling back to the wrong version.

@mansiverma897993

Copy link
Copy Markdown
Contributor Author

@alice-i-cecile Thanks for the review and feedback! I'll run the formatting pass and push the changes shortly.

@mansiverma897993

mansiverma897993 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@alice-i-cecile @mnmaita done with all test lemme know if any other changes still required!!

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jun 25, 2026
Merged via the queue into bevyengine:main with commit 6628c6e Jun 25, 2026
38 checks passed
@mansiverma897993 mansiverma897993 deleted the fix-nextstate-set-if-neq-clash branch June 25, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-States App-level states machines C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NextState::set_if_neq() name clashing

4 participants