-
Notifications
You must be signed in to change notification settings - Fork 3
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-861]: Fix borked enum variant name formatting #61
[PLATFORM-861]: Fix borked enum variant name formatting #61
Conversation
src/private.rs
Outdated
/// Whether the type we're redacting is an Option<T> or not. Poor man's specialization! This is detected | ||
/// by the proc macro reading the path to the type, so it's not perfect. | ||
/// | ||
/// This could be improved & rid of in a number of different ways in the future: | ||
/// | ||
/// * Once specialization is stabilized, we can use a trait to override redacting behaviour for some types, | ||
/// * Once specialization is stabilized, we can use a trait to override redacting behavior for some types, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't believe a british dev would do this. Did it hurt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💀
Moved my review over to #60 where it belongs |
15af92f
to
caba792
Compare
@@ -168,7 +168,7 @@ pub(super) fn derive_redact( | |||
for (variant, flags) in e.variants.iter().zip(variant_flags.into_iter()) { | |||
// Variant name redacting | |||
let variant_name = variant.ident.to_string(); | |||
let variant_name = if let Some(flags) = &flags.variant_flags { | |||
let variant_name = if let Some(flags @ FieldFlags { skip: false, .. }) = &flags.variant_flags { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for me: wth is @
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it binds the flags variable and matches the pattern
https://doc.rust-lang.org/stable/rust-by-example/flow_control/match/binding.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
such an awesome feature :)
https://prima-assicurazioni-spa.myjetbrains.com/youtrack/issue/PLATFORM-861
Fixes a weird edge case where enum variant names were not being formatted correctly.
Added tests to ensure that we don't regress this in future.