mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
Support extra constant renaming (#9814)
* Rebased with master. Resolved merge conflict in frame/support/test/tests/pallet.rs * Switching Account ID to SomeType1, as SomeType3 was giving me conversion error. * Wrong indent config. Fixed. * These tabs look fine locally, but look different on Github. Trying to get the style config right. * Parsing pallet::constant_name. Passing unit tests, which is confusing because I didn't change `ident` in the ExtraConstantDef initialization. * Finalized parsing of extra constant name by adding optional metadata field. Added expansion logic that replaces respective `idents` where they exist. * Erasing this to try to keep the format the same across the source code. * Another formatting change for consistency. * Update frame/support/procedural/src/pallet/expand/constants.rs strictly more idiomatic. Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/procedural/src/pallet/parse/extra_constants.rs strictly idiomatic change. Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Fixing formatting and CI warnings. * switched to nightly compiler to use rustfmt.toml Co-authored-by: Eric Miller <emiller@lirio.co> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -146,6 +146,12 @@ pub mod pallet {
|
||||
fn some_extra_extra() -> T::AccountId {
|
||||
SomeType1.into()
|
||||
}
|
||||
|
||||
/// Some doc
|
||||
#[pallet::constant_name(SomeExtraRename)]
|
||||
fn some_extra_rename() -> T::AccountId {
|
||||
SomeType1.into()
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
@@ -1220,6 +1226,12 @@ fn metadata() {
|
||||
value: vec![0, 0, 0, 0, 0, 0, 0, 0],
|
||||
docs: vec![" Some doc"],
|
||||
},
|
||||
PalletConstantMetadata {
|
||||
name: "SomeExtraRename",
|
||||
ty: meta_type::<u64>(),
|
||||
value: vec![0, 0, 0, 0, 0, 0, 0, 0],
|
||||
docs: vec![" Some doc"],
|
||||
},
|
||||
],
|
||||
error: Some(PalletErrorMetadata { ty: meta_type::<pallet::Error<Runtime>>() }),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user