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

[PLATFORM-833]: Add a way of using the Display implementation instead of the Debug implementation when redacting #58

Merged
merged 5 commits into from
Dec 15, 2022

Conversation

WilliamVenner
Copy link
Contributor

https://prima-assicurazioni-spa.myjetbrains.com/youtrack/issue/PLATFORM-833

This PR implements the #[redact(display)] option which allows the user to override which format implementation is chosen to redact.

This allows users to choose redacting the output of a type's std::fmt::Display implementation where they feel is appropriate.

Relevant Slack discussion https://prima.slack.com/archives/C01C70U9F37/p1670860264520579

@WilliamVenner WilliamVenner requested a review from a team as a code owner December 13, 2022 11:36
@WilliamVenner WilliamVenner force-pushed the PLATFORM-833/user-story/use-display branch from 68305f6 to 654faab Compare December 13, 2022 16:46
@oliverbrowneprima
Copy link

Could you add some tests that include macro invocation with display in here?

@WilliamVenner
Copy link
Contributor Author

@oliverbrowneprima Uhh yeah is the test in redaction_tests.rs not enough?

@oliverbrowneprima
Copy link

I'd prefer, for the sake of avoiding regressions in the future, if there was also:

  • Redacted Display on a struct with named members
  • Redacted Display on an enum
  • A case that actually redacts some data (e.g. make that string contain something)
  • A case that derives both a redacted Display and Debug, and asserts they work as expected (with some actual redaction occuring)

Copy link
Contributor

@cpiemontese cpiemontese left a comment

Choose a reason for hiding this comment

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

Really nice, I agree on adding a few more test cases which capture how we expect this to behave

@cpiemontese cpiemontese requested review from Fs00 and a team December 14, 2022 11:14
@WilliamVenner
Copy link
Contributor Author

Cheers guys, caught somewhere where #[redact(display)] shouldn't be 🙂

@WilliamVenner WilliamVenner merged commit 4f3581e into master Dec 15, 2022
@WilliamVenner WilliamVenner deleted the PLATFORM-833/user-story/use-display branch December 15, 2022 09:21
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