Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rename hex_impl! to fmt_impl! and reuse it for fmt::Debug #743

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

LogvinovLeon
Copy link
Contributor

@LogvinovLeon LogvinovLeon commented Oct 26, 2024

In fmt module there are two submodules:

  • debug - Implementing fmt::Debug
  • hex - Implementing fmt::LowerHex, fmt::UpperHex

Both implement core logic for BytesRef<'_>, but later one used a macro to propagate it to Bytes and BytesMut while other did it manually. This PR fixes that.

Macro imports in rust edition 2018 are limited. Therefore - I needed to first define a macro in a super module and later add #[macro_use] attribute to submodules.

I've tested that this solution does not leak the macro to the library public interface or docs.

Saves 9 lines of code ;) 16 insertions(+), 25 deletions(-)

src/fmt/mod.rs Outdated Show resolved Hide resolved
@LogvinovLeon LogvinovLeon requested a review from Darksonn October 26, 2024 14:00
@LogvinovLeon
Copy link
Contributor Author

@Darksonn are there any other changes you want me to make to this PR?

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks.

@Darksonn Darksonn merged commit 54f1c26 into tokio-rs:master Nov 8, 2024
15 checks passed
@LogvinovLeon LogvinovLeon deleted the leo/fmt_impl branch November 8, 2024 09:28
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants