From c01c61effe469fd25fd2520a7b3a9b960fdb054f Mon Sep 17 00:00:00 2001 From: James Wilson Date: Wed, 10 Apr 2024 17:49:40 +0100 Subject: [PATCH] Swap BinaryHeap for Vec to avoid Ord constraint issue (#1523) * Swap BianryHeap for KeyedVec to avoid Ord constraint issue * Vec, not KeyedVec --- codegen/src/lib.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 47631888a9..4ae257db86 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -346,7 +346,7 @@ fn default_derives(crate_path: &syn::Path) -> DerivesRegistry { fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes { let mut type_substitutes = TypeSubstitutes::new(); - let defaults: [(syn::Path, syn::Path); 11] = [ + let defaults: [(syn::Path, syn::Path); 12] = [ ( parse_quote!(bitvec::order::Lsb0), parse_quote!(#crate_path::utils::bits::Lsb0), @@ -387,7 +387,14 @@ fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes { parse_quote!(BTreeMap), parse_quote!(#crate_path::utils::KeyedVec), ), - (parse_quote!(BTreeSet), parse_quote!(::std::vec::Vec)), + ( + parse_quote!(BinaryHeap), + parse_quote!(::std::vec::Vec), + ), + ( + parse_quote!(BTreeSet), + parse_quote!(::std::vec::Vec), + ), // The `UncheckedExtrinsic(pub Vec)` is part of the runtime API calls. // The inner bytes represent the encoded extrinsic, however when deriving the // `EncodeAsType` the bytes would be re-encoded. This leads to the bytes