Skip to content

Commit

Permalink
Merge pull request #1572 from tjkirch/legacy_derive_helpers
Browse files Browse the repository at this point in the history
model-derive: add derive attributes at start of list
  • Loading branch information
tjkirch authored May 13, 2021
2 parents af83282 + 3a58033 commit 63fc9c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sources/models/model-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ impl VisitMut for ModelHelper {
} else {
parse_quote!(#[derive(Debug, PartialEq, Serialize, Deserialize)])
};
node.attrs.push(attr);
// 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.
node.attrs.insert(0, attr);
}

// Let the default implementation do its thing, recursively.
Expand Down

0 comments on commit 63fc9c7

Please sign in to comment.