Skip to content

Commit eba7dc5

Browse files
committed
model-derive: add derive attributes at start of list
Rust 1.52 added a legacy_derive_helpers warning (soon to be an error) that yells if you use an attribute macro before the derive macro that introduces it. We should always put derive macros at the start of the list to avoid this. Reference: rust-lang/rust#79202
1 parent de765ec commit eba7dc5

File tree

1 file changed

+4
-1
lines changed
  • sources/models/model-derive/src

1 file changed

+4
-1
lines changed

sources/models/model-derive/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ impl VisitMut for ModelHelper {
130130
} else {
131131
parse_quote!(#[derive(Debug, PartialEq, Serialize, Deserialize)])
132132
};
133-
node.attrs.push(attr);
133+
// Rust 1.52 added a legacy_derive_helpers warning (soon to be an error) that yells if
134+
// you use an attribute macro before the derive macro that introduces it. We should
135+
// always put derive macros at the start of the list to avoid this.
136+
node.attrs.insert(0, attr);
134137
}
135138

136139
// Let the default implementation do its thing, recursively.

0 commit comments

Comments
 (0)