Skip to content

Commit 4bed7eb

Browse files
authored
Fix conversion of Call struct names to UpperCamelCase (paritytech#441)
* Fix conversion of `Call` struct names to UpperCamelCase * Update to latest heck and use ToUpperCamelCase
1 parent a7c54f7 commit 4bed7eb

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

codegen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async-trait = "0.1.49"
1515
codec = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive", "full", "bit-vec"] }
1616
darling = "0.13.0"
1717
frame-metadata = "14.0"
18-
heck = "0.3.2"
18+
heck = "0.4.0"
1919
proc-macro2 = "1.0.24"
2020
proc-macro-crate = "0.1.5"
2121
proc-macro-error = "1.0.4"

codegen/src/api/calls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use frame_metadata::{
2323
PalletMetadata,
2424
};
2525
use heck::{
26-
CamelCase as _,
27-
SnakeCase as _,
26+
ToSnakeCase as _,
27+
ToUpperCamelCase as _,
2828
};
2929
use proc_macro2::TokenStream as TokenStream2;
3030
use proc_macro_error::abort_call_site;
@@ -43,7 +43,7 @@ pub fn generate_calls(
4343
let struct_defs = super::generate_structs_from_variants(
4444
type_gen,
4545
call.ty.id(),
46-
|name| name.to_camel_case().into(),
46+
|name| name.to_upper_camel_case().into(),
4747
"Call",
4848
);
4949
let (call_structs, call_fns): (Vec<_>, Vec<_>) = struct_defs

codegen/src/api/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use crate::types::TypeGenerator;
1818
use frame_metadata::PalletConstantMetadata;
19-
use heck::SnakeCase as _;
19+
use heck::ToSnakeCase as _;
2020
use proc_macro2::TokenStream as TokenStream2;
2121
use quote::{
2222
format_ident,

codegen/src/api/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use frame_metadata::{
5454
RuntimeMetadataPrefixed,
5555
StorageEntryType,
5656
};
57-
use heck::SnakeCase as _;
57+
use heck::ToSnakeCase as _;
5858
use proc_macro2::TokenStream as TokenStream2;
5959
use proc_macro_error::abort_call_site;
6060
use quote::{
@@ -462,7 +462,7 @@ where
462462
type_gen,
463463
);
464464
CompositeDef::struct_def(
465-
var.name(),
465+
struct_name.as_ref(),
466466
Default::default(),
467467
fields,
468468
Some(parse_quote!(pub)),

codegen/src/api/storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use frame_metadata::{
2323
StorageEntryType,
2424
StorageHasher,
2525
};
26-
use heck::SnakeCase as _;
26+
use heck::ToSnakeCase as _;
2727
use proc_macro2::TokenStream as TokenStream2;
2828
use proc_macro_error::abort_call_site;
2929
use quote::{

macro/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async-trait = "0.1.49"
1919
codec = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive", "full"] }
2020
darling = "0.13.0"
2121
frame-metadata = "14.0"
22-
heck = "0.3.2"
22+
heck = "0.4.0"
2323
proc-macro2 = "1.0.24"
2424
proc-macro-crate = "0.1.5"
2525
proc-macro-error = "1.0.4"

0 commit comments

Comments
 (0)