Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Review fixes
Co-authored-by: Sam Johnson <[email protected]>

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez committed Apr 20, 2023
commit 8edf2330ee79263000e32090a9cd66e9080e6350
6 changes: 2 additions & 4 deletions frame/support/procedural/src/pallet/expand/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {

let mut fn_weight = Vec::<TokenStream2>::new();
let mut weight_warnings = Vec::new();
for method in methods.iter() {
for method in &methods {
match &method.weight {
CallWeightDef::DevModeDefault => {
fn_weight.push(syn::parse_quote!(0));
},
CallWeightDef::DevModeDefault => fn_weight.push(syn::parse_quote!(0)),
CallWeightDef::Immediate(e @ syn::Expr::Lit(lit)) if !def.dev_mode => {
let warning = proc_macro_warning::Warning::new_deprecated("ConstantWeight")
.index(weight_warnings.len())
Expand Down
4 changes: 3 additions & 1 deletion frame/support/procedural/src/pallet/parse/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ impl CallDef {
0 if dev_mode => CallWeightDef::DevModeDefault,
0 => return Err(syn::Error::new(
method.sig.span(),
"A pallet::call requires either a concrete `#[pallet::weight($expr)]` or an inherited weight from the `#[pallet:call(weight($type))]` attribute, but none were given.",
"A pallet::call requires either a concrete `#[pallet::weight($expr)]` or an
inherited weight from the `#[pallet:call(weight($type))]` attribute, but
none were given.",
)),
1 => match weight_attrs.pop().unwrap() {
FunctionAttr::Weight(w) => CallWeightDef::Immediate(w),
Expand Down