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

Replace Vec::from_hex with hex! #1438

Merged
merged 1 commit into from Jan 1, 2023

Conversation

Kixunil
Copy link
Collaborator

@Kixunil Kixunil commented Dec 3, 2022

This makes the code less noisy and is a preparation for changing it to const-based literal. Because of the preparation, places that used variables to store the hex string were changed to constants.

There are still some instances of Vec::from_hex left - where they won't be changeable to const and where hex! is unavailable (integration tests). These may be dealt with later.

See also #1189

Note that while the change appears big it's nearly entirely mechanical, so should be pretty easy to review. (But I don't feel it's trivial.)

@Kixunil Kixunil added the code quality Makes code easier to understand and less likely to lead to problems label Dec 3, 2022
@Kixunil Kixunil force-pushed the use-hex-macro branch 2 times, most recently from 103f434 to 22ab8d7 Compare December 3, 2022 22:16
sanket1729
sanket1729 previously approved these changes Dec 4, 2022
Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

ACK 22ab8d7. Thanks for exporting the pub macro in tests. I have versions of this in many downstream repos.

@Kixunil
Copy link
Collaborator Author

Kixunil commented Dec 4, 2022

@sanket1729 oh crap, that is a remnant of my failed experiment. It doesn't work the way I intended. I want to change it to hex_lit crate if @TheBlueMatt agrees. You could use that one too.

Edit: I removed the reexport because it's broken anyway.

bitcoin/src/lib.rs Outdated Show resolved Hide resolved
tcharding
tcharding previously approved these changes Dec 23, 2022
Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK f797947

sanket1729
sanket1729 previously approved these changes Dec 29, 2022
Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

ACK f797947

@apoelstra
Copy link
Member

Needs rebase after #1387

This makes the code less noisy and is a preparation for changing it to
`const`-based literal. Because of the preparation, places that used
variables to store the hex string were changed to constants.

There are still some instances of `Vec::from_hex` left - where they
won't be changeable to `const` and where `hex!` is unavailable
(integration tests). These may be dealt with later.

See also rust-bitcoin#1189
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 089a1e4

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK 089a1e4

Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

code review ACk 089a1e4

@sanket1729 sanket1729 merged commit 98203bc into rust-bitcoin:master Jan 1, 2023
@Kixunil Kixunil deleted the use-hex-macro branch January 1, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Makes code easier to understand and less likely to lead to problems is blocking other Something else is blocked on this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants