mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Reformat types string for decl_storage (#1298)
* Clean space from types when converting to string * Missing cases. * Add unit test for complex type, complete clean fn.
This commit is contained in:
@@ -92,3 +92,22 @@ pub fn generate_hidden_includes(unique_id: &str, def_crate: &str, crate_id: &str
|
||||
)
|
||||
}.into()
|
||||
}
|
||||
|
||||
// fn to remove white spaces arount string types
|
||||
// (basically whitespaces arount tokens)
|
||||
pub fn clean_type_string(input: &str) -> String {
|
||||
input
|
||||
.replace(" ::", "::")
|
||||
.replace(":: ", "::")
|
||||
.replace(" ,", ",")
|
||||
.replace(" ;", ";")
|
||||
.replace(" [", "[")
|
||||
.replace("[ ", "[")
|
||||
.replace(" ]", "]")
|
||||
.replace(" (", "(")
|
||||
.replace("( ", "(")
|
||||
.replace(" )", ")")
|
||||
.replace(" <", "<")
|
||||
.replace("< ", "<")
|
||||
.replace(" >", ">")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user