api-macros: Replace if-then-panic with assert

This commit is contained in:
Jonas Platte 2021-09-30 20:14:09 +02:00
parent bb581e9252
commit a887dd7387
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -123,9 +123,10 @@ impl Response {
pub fn check(&self) -> syn::Result<()> {
// TODO: highlight problematic fields
if !self.generics.params.is_empty() || self.generics.where_clause.is_some() {
panic!("This macro doesn't support generic types");
}
assert!(
self.generics.params.is_empty() && self.generics.where_clause.is_none(),
"This macro doesn't support generic types"
);
let newtype_body_fields = self
.fields