superstruct icon indicating copy to clipboard operation
superstruct copied to clipboard

Should reject unused top-level attributes with `no_enum`

Open michaelsproul opened this issue 1 year ago • 0 comments

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.

michaelsproul avatar Nov 30 '22 03:11 michaelsproul