From 113cc2c48e1d276db2a1f95cf446f352cdaf1892 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 29 Jun 2021 13:58:28 +0100 Subject: [PATCH 1/2] WIP reexport codec --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 08436429..c9a9002c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -308,6 +308,9 @@ mod utils; #[cfg(test)] mod tests; +#[doc(hidden)] +pub use codec; + pub use self::{ meta_type::MetaType, registry::{ From b9353bbfee6904cd215bc7f6e363b6677c9d48c9 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 29 Jun 2021 16:14:06 +0100 Subject: [PATCH 2/2] Rexport parity-scale-codec as scale --- derive/src/lib.rs | 2 -- derive/src/trait_bounds.rs | 3 +-- src/lib.rs | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/derive/src/lib.rs b/derive/src/lib.rs index d6a6d32d..20b97277 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -65,7 +65,6 @@ fn generate_type(input: TokenStream2) -> Result { let attrs = attr::Attributes::from_ast(&ast)?; let scale_info = crate_name_ident("scale-info")?; - let parity_scale_codec = crate_name_ident("parity-scale-codec")?; let ident = &ast.ident; @@ -75,7 +74,6 @@ fn generate_type(input: TokenStream2) -> Result { &ast.generics, &ast.data, &scale_info, - &parity_scale_codec, )?; let (impl_generics, ty_generics, _) = ast.generics.split_for_impl(); diff --git a/derive/src/trait_bounds.rs b/derive/src/trait_bounds.rs index 0edfd230..1b4a3a96 100644 --- a/derive/src/trait_bounds.rs +++ b/derive/src/trait_bounds.rs @@ -53,7 +53,6 @@ pub fn make_where_clause<'a>( generics: &'a Generics, data: &'a syn::Data, scale_info: &Ident, - parity_scale_codec: &Ident, ) -> Result { let mut where_clause = generics.where_clause.clone().unwrap_or_else(|| { WhereClause { @@ -97,7 +96,7 @@ pub fn make_where_clause<'a>( if is_compact { where_clause .predicates - .push(parse_quote!(#ty : :: #parity_scale_codec ::HasCompact)); + .push(parse_quote!(#ty : :: #scale_info :: scale::HasCompact)); } else { where_clause .predicates diff --git a/src/lib.rs b/src/lib.rs index c9a9002c..4a4dd333 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -309,7 +309,7 @@ mod utils; mod tests; #[doc(hidden)] -pub use codec; +pub use scale; pub use self::{ meta_type::MetaType,