Remove redundant condition in findBoundingRects#36214
Open
w3di wants to merge 1 commit intofacebook:mainfrom
Open
Remove redundant condition in findBoundingRects#36214w3di wants to merge 1 commit intofacebook:mainfrom
w3di wants to merge 1 commit intofacebook:mainfrom
Conversation
The inner loop initializes j to i - 1 and decrements, so j is always strictly less than i. The condition `i !== j` is always true and can be removed along with its unnecessary nesting level.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
ReactTestSelectors.js, the inner loop infindBoundingRectsinitializesjtoi - 1and decrements, sojis always strictly less thani. The conditionif (i !== j)is always true and adds an unnecessary nesting level.Removed the condition and reduced indentation accordingly. No behavioral change.
How did you test this change?
Logic analysis:
jis initialized toi - 1(soj < i) and only decrements in the loop, makingjalways strictly less thani. The condition can never be false.