sigp / superstruct

Rust library for versioned data types
https://sigp.github.io/superstruct/
Apache License 2.0
65 stars 3 forks source link

Should reject unused top-level attributes with `no_enum` #26

Open michaelsproul opened 1 year ago

michaelsproul commented 1 year ago

Presently superstruct will accept code like:

#[superstruct(no_enum, variants(A, B))]
#[derive(Serialize, Deserialize)]
pub struct Thing {
   ...
}

The derive(Serialize, Deserialize) doesn't make sense here because there's no top-level type. The attribute is silently ignored. We should instead raise a compile-time error or warning so this useless code can be deleted.