Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
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
bit more dry
  • Loading branch information
ruseinov committed Feb 13, 2023
commit fc974b37b47c29afb75bf45267e613bd7e49e3f1
6 changes: 2 additions & 4 deletions frame/support/procedural/src/storage_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,7 @@ fn generate_storage_instance(
let name = Ident::new(&format!("{}_Storage_Instance", storage_name), Span::call_site());
let storage_name_str = storage_name.to_string();

let mut counter_code = Option::None;

if is_counted_map {
let counter_code = is_counted_map.then(|| {
let counter_name = Ident::new(&format!("Counter_{}", name), Span::call_site());
let counter_storage_name_str = "counter_".to_owned() + &storage_name_str;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use this function there

fn counter_prefix(prefix: &str) -> String {

Move it somewhere in the crate to reuse it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good spot, going to check this out!


Expand All @@ -620,7 +618,7 @@ fn generate_storage_instance(
type CounterPrefix = #counter_name;
}
});
}
});

// Implement `StorageInstance` trait.
let code = quote! {
Expand Down