aboutsummaryrefslogtreecommitdiffstats
path: root/validator_derive/src
diff options
context:
space:
mode:
authortheduke2017-02-10 04:50:21 +0100
committertheduke2017-02-10 04:50:21 +0100
commit77503cbf5e16f1f25278940b44c60060825a3b19 (patch)
tree73582dc2fcdaa0fe7b5dae497f3b4d60fdfb2db4 /validator_derive/src
parent8ac866fc289ca90168a5546d8def1c7de878b4af (diff)
downloadvalidator-77503cbf5e16f1f25278940b44c60060825a3b19.tar.bz2
validator_derive: Properly skip foreign attributes.
The old code only skips attributes if they are MetaItem::List. With a simple change, all attributes are skipped if they are not named "validate".
Diffstat (limited to 'validator_derive/src')
-rw-r--r--validator_derive/src/lib.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/validator_derive/src/lib.rs b/validator_derive/src/lib.rs
index 0ad26a9..735ac44 100644
--- a/validator_derive/src/lib.rs
+++ b/validator_derive/src/lib.rs
@@ -313,12 +313,11 @@ fn find_struct_validation(struct_attrs: &Vec<syn::Attribute>) -> Option<SchemaVa
};
for attr in struct_attrs {
+ if attr.value.name() != "validate" {
+ continue;
+ }
match attr.value {
syn::MetaItem::List(ref ident, ref meta_items) => {
- if ident != "validate" {
- continue;
- }
-
match meta_items[0] {
syn::NestedMetaItem::MetaItem(ref item) => match item {
&syn::MetaItem::List(ref ident2, ref args) => {