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

Add Display implementation for newtype wrappers #301

Merged
merged 2 commits into from
Mar 22, 2023

Conversation

nick-mobilecoin
Copy link
Collaborator

@nick-mobilecoin nick-mobilecoin commented Mar 15, 2023

Previously the newtype implementations didn't implement the Display
trait. Now the Display trait is implemented on any newtype that uses
one of impl_newtype or impl_newtype_for_bytestruct.

Renamed the internal macro new_type_accessors_impls to
impl_newtype for consistency.

@nick-mobilecoin
Copy link
Collaborator Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@meowblecoinbot meowblecoinbot requested review from a team and varsha888 and removed request for a team March 15, 2023 22:24
@github-actions github-actions bot added size/L PRs with more than 500 lines of changes rust Pull requests that update Rust code labels Mar 15, 2023
@github-actions
Copy link

github-actions bot commented Mar 15, 2023

❌ Unreviewed dependencies found

Crate Version Reviews (N/2) LoC Left-Pad Index Geiger Flags
yare 1.0.2 0 89 12 0 ____
static_assertions 1.1.0 0 243 167 0 ____
subtle 2.4.1 0 377 143 3 ____
displaydoc 0.2.3 0 409 62 24 ____
serial_test 1.0.0 0 768 42 0 ____
cargo-emit 0.2.1 0 824 10 0 ____
rand_core 0.6.4 0 829 156 2 ____
tempfile 3.4.0 1 936 103 46 ____
getrandom 0.2.8 0 969 142 183 ____
sha2 0.10.6 0 1061 107 204 ____
once_cell 1.17.1 0 1101 134 139 ____
bitflags 2.0.2 0 1949 92 0 ____
textwrap 0.16.0 0 2234 75 0 ____
p256 0.13.0 0 2568 20 0 ____
rand 0.8.5 0 5273 60 32 ____
nom 7.1.3 0 10471 31 40 ____
bindgen 0.64.0 0 20421 14 405 CB__
libc 0.2.140 0 97312 15 515 CB__

@codecov
Copy link

codecov bot commented Mar 15, 2023

Codecov Report

Merging #301 (6a993f4) into main (f8ec40a) will increase coverage by 0.13%.
The diff coverage is 98.36%.

@@            Coverage Diff             @@
##             main     #301      +/-   ##
==========================================
+ Coverage   88.27%   88.41%   +0.13%     
==========================================
  Files          46       46              
  Lines        4154     4212      +58     
==========================================
+ Hits         3667     3724      +57     
- Misses        487      488       +1     
Impacted Files Coverage Δ
core/types/src/attestation_key.rs 97.01% <ø> (ø)
core/types/src/attributes.rs 96.29% <ø> (ø)
core/types/src/config_id.rs 100.00% <ø> (ø)
core/types/src/key_request.rs 80.15% <0.00%> (-0.62%) ⬇️
core/types/src/quote.rs 99.17% <ø> (ø)
core/types/src/report.rs 100.00% <ø> (ø)
core/types/src/svn.rs 100.00% <ø> (ø)
core/types/src/target_info.rs 100.00% <ø> (ø)
dcap/types/src/quoting_enclave.rs 100.00% <ø> (ø)
core/types/src/macros.rs 93.07% <100.00%> (+5.40%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Previously the new type implementations didn't implement the `Display`
trait. Now the `Display` trait is implemented on any new type that uses
one of `impl_newtype` or `impl_newtype_for_bytestruct`.

Renamed the internal macro `new_type_accessors_impls` to
`impl_newtype` for consistency.
Copy link
Contributor

@jcape jcape left a comment

Choose a reason for hiding this comment

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

I'm surprised the missing space before $wrapper compiles...

core/types/src/macros.rs Outdated Show resolved Hide resolved
core/types/src/macros.rs Outdated Show resolved Hide resolved
core/types/src/macros.rs Outdated Show resolved Hide resolved
Previously some `core::...` usages in macros lacked the leading `::` to
indicate absolute crate paths. Now the usages are of the form
`::core::...`.

Made the hex output of wrapped C byte structs use an underscore every 2
bytes.
@nick-mobilecoin nick-mobilecoin requested a review from jcape March 20, 2023 16:31
@nick-mobilecoin nick-mobilecoin changed the title Add Display implementation for new type wrappers Add Display implementation for newtype wrappers Mar 21, 2023
@nick-mobilecoin nick-mobilecoin merged commit 45d890a into main Mar 22, 2023
@nick-mobilecoin nick-mobilecoin deleted the nick/display_trait branch March 22, 2023 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Pull requests that update Rust code size/L PRs with more than 500 lines of changes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Implement Display for types
3 participants