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

Refactor: Remove StringPart and AnyStringPart in favor of StringLikePart #13772

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Oct 16, 2024

Summary

I don't think having both types still makes sense.
The way I remember it is that we had StringPart first, a generic representation of any string part.
We later introduced AnyStringPart without realizing that we now have two generic representations of a string part. We then also added StringLike when we needed a similar construct in the linter. And there were three representations :)

This PR removes StringPart and AnyStringPart and replaces them with StringLikePart, to only have one generic string part representation.

Split out from #13663

Test Plan

cargo test

@MichaReiser MichaReiser added internal An internal refactor or improvement formatter Related to the formatter labels Oct 16, 2024
Copy link
Contributor

github-actions bot commented Oct 16, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser MichaReiser changed the title Refactor: Remove StringPart and use AnyStringPart instead Refactor: Remove StringPart and AnyStringPart in favor of StringLike Oct 16, 2024
@MichaReiser MichaReiser changed the title Refactor: Remove StringPart and AnyStringPart in favor of StringLike Refactor: Remove StringPart and AnyStringPart in favor of StringLikePart Oct 16, 2024
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

This is great, lots of code removed. Thanks for doing this!

I agree that it's a bit annoying to add formatter specific methods but the StringLikeExtensions trait is a good idea.

@MichaReiser MichaReiser merged commit 8f5b2aa into main Oct 16, 2024
20 checks passed
@MichaReiser MichaReiser deleted the micha/remove-string-part branch October 16, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants