macros: Fix unnecessary named fields requirement in EventContent derive
This commit is contained in:
parent
44ed91a5af
commit
46bab5cca6
@ -183,13 +183,9 @@ fn generate_redacted_event_content(
|
|||||||
let redacted_ident = format_ident!("Redacted{}", ident);
|
let redacted_ident = format_ident!("Redacted{}", ident);
|
||||||
|
|
||||||
let kept_redacted_fields =
|
let kept_redacted_fields =
|
||||||
if let syn::Data::Struct(syn::DataStruct {
|
if let syn::Data::Struct(st) = &input.data {
|
||||||
fields: syn::Fields::Named(syn::FieldsNamed { named, .. }),
|
|
||||||
..
|
|
||||||
}) = &input.data
|
|
||||||
{
|
|
||||||
// this is to validate the `#[ruma_event(skip_redaction)]` attribute
|
// this is to validate the `#[ruma_event(skip_redaction)]` attribute
|
||||||
named
|
st.fields
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|f| &f.attrs)
|
.flat_map(|f| &f.attrs)
|
||||||
.filter(|a| a.path.is_ident("ruma_event"))
|
.filter(|a| a.path.is_ident("ruma_event"))
|
||||||
@ -202,7 +198,8 @@ fn generate_redacted_event_content(
|
|||||||
})
|
})
|
||||||
.unwrap_or(Ok(()))?;
|
.unwrap_or(Ok(()))?;
|
||||||
|
|
||||||
let mut fields: Vec<_> = named
|
let mut fields: Vec<_> = st
|
||||||
|
.fields
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|f| {
|
.filter(|f| {
|
||||||
matches!(
|
matches!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user