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

Custom eq for ResourceKey #2163

Merged
merged 4 commits into from
Jul 12, 2022
Merged

Custom eq for ResourceKey #2163

merged 4 commits into from
Jul 12, 2022

Conversation

robertbastian
Copy link
Member

No description provided.

@robertbastian robertbastian requested review from a team, sffc and Manishearth as code owners July 11, 2022 17:01
@robertbastian robertbastian removed the request for review from a team July 11, 2022 17:04
Manishearth
Manishearth previously approved these changes Jul 11, 2022
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

I support this change! Just a few comments

provider/core/src/datagen/mod.rs Show resolved Hide resolved
provider/core/src/resource.rs Show resolved Hide resolved
provider/core/src/resource.rs Show resolved Hide resolved
provider/fs/src/export/fs_exporter.rs Show resolved Hide resolved
match key {
CardinalV1Marker::KEY => self
.source
if key == CardinalV1Marker::KEY {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Why did you change this function? I think match on ResourceKey should still work (just less efficient)

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, you can only match on const values that have a derived PartialEq.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is why I didn't want to add fields to ResourceKey

Copy link
Member

Choose a reason for hiding this comment

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

Nit (optional): Can we keep them as match but match on the string path, creating local constants? Then, if/when Rust adds support for { constexpr } as Manish suggested, we can migrate to it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I considered that but the if/else is more concise

@robertbastian robertbastian requested a review from sffc July 11, 2022 19:14
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Please check the path string in impl PartialEq, and consider recovering the match

@robertbastian robertbastian requested a review from sffc July 12, 2022 09:21
@sffc sffc merged commit 83ac41f into unicode-org:main Jul 12, 2022
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

LGTM and merged

@robertbastian robertbastian deleted the eq branch July 13, 2022 17:08
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