Fix handling of attributes applied to unit variant types (#152)

This commit is contained in:
Adam Leventhal 2022-08-12 07:37:34 -07:00 committed by GitHub
parent 9464118c3a
commit 76427ef384
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 109 additions and 28 deletions

View file

@ -185,6 +185,21 @@ impl Attrs {
}
self
}
pub fn is_default(&self) -> bool {
match self {
Self {
with: None,
title: None,
description: None,
deprecated: false,
examples,
repr: None,
crate_name: None,
} if examples.is_empty() => true,
_ => false,
}
}
}
fn is_known_serde_or_validation_keyword(meta: &syn::Meta) -> bool {