style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -112,8 +112,9 @@ pub fn take_or_else<T: Codec + Sized, F: FnOnce() -> T>(
|
||||
/// Check to see if `key` has an explicit entry in storage.
|
||||
pub fn exists(child_info: &ChildInfo, key: &[u8]) -> bool {
|
||||
match child_info.child_type() {
|
||||
ChildType::ParentKeyId =>
|
||||
pezsp_io::default_child_storage::exists(child_info.storage_key(), key),
|
||||
ChildType::ParentKeyId => {
|
||||
pezsp_io::default_child_storage::exists(child_info.storage_key(), key)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,8 +140,9 @@ pub fn exists(child_info: &ChildInfo, key: &[u8]) -> bool {
|
||||
#[deprecated = "Use `clear_storage` instead"]
|
||||
pub fn kill_storage(child_info: &ChildInfo, limit: Option<u32>) -> KillStorageResult {
|
||||
match child_info.child_type() {
|
||||
ChildType::ParentKeyId =>
|
||||
pezsp_io::default_child_storage::storage_kill(child_info.storage_key(), limit),
|
||||
ChildType::ParentKeyId => {
|
||||
pezsp_io::default_child_storage::storage_kill(child_info.storage_key(), limit)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,8 +187,9 @@ pub fn clear_storage(
|
||||
// enabled.
|
||||
// pezsp_io::default_child_storage::storage_kill(prefix, maybe_limit, maybe_cursor)
|
||||
let r = match child_info.child_type() {
|
||||
ChildType::ParentKeyId =>
|
||||
pezsp_io::default_child_storage::storage_kill(child_info.storage_key(), maybe_limit),
|
||||
ChildType::ParentKeyId => {
|
||||
pezsp_io::default_child_storage::storage_kill(child_info.storage_key(), maybe_limit)
|
||||
},
|
||||
};
|
||||
use pezsp_io::KillStorageResult::*;
|
||||
let (maybe_cursor, backend) = match r {
|
||||
@@ -208,24 +211,27 @@ pub fn kill(child_info: &ChildInfo, key: &[u8]) {
|
||||
/// Get a Vec of bytes from storage.
|
||||
pub fn get_raw(child_info: &ChildInfo, key: &[u8]) -> Option<Vec<u8>> {
|
||||
match child_info.child_type() {
|
||||
ChildType::ParentKeyId =>
|
||||
pezsp_io::default_child_storage::get(child_info.storage_key(), key),
|
||||
ChildType::ParentKeyId => {
|
||||
pezsp_io::default_child_storage::get(child_info.storage_key(), key)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Put a raw byte slice into storage.
|
||||
pub fn put_raw(child_info: &ChildInfo, key: &[u8], value: &[u8]) {
|
||||
match child_info.child_type() {
|
||||
ChildType::ParentKeyId =>
|
||||
pezsp_io::default_child_storage::set(child_info.storage_key(), key, value),
|
||||
ChildType::ParentKeyId => {
|
||||
pezsp_io::default_child_storage::set(child_info.storage_key(), key, value)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate current child root value.
|
||||
pub fn root(child_info: &ChildInfo, version: StateVersion) -> Vec<u8> {
|
||||
match child_info.child_type() {
|
||||
ChildType::ParentKeyId =>
|
||||
pezsp_io::default_child_storage::root(child_info.storage_key(), version),
|
||||
ChildType::ParentKeyId => {
|
||||
pezsp_io::default_child_storage::root(child_info.storage_key(), version)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -189,9 +189,13 @@ mod tests {
|
||||
);
|
||||
|
||||
// do translation.
|
||||
NumberMap::translate(
|
||||
|k: u32, v: u64| if k.is_multiple_of(2) { Some(((k as u64) << 32) | v) } else { None },
|
||||
);
|
||||
NumberMap::translate(|k: u32, v: u64| {
|
||||
if k.is_multiple_of(2) {
|
||||
Some(((k as u64) << 32) | v)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
NumberMap::iter().collect::<Vec<_>>(),
|
||||
|
||||
@@ -592,7 +592,10 @@ mod tests {
|
||||
pezsp_io::TestExternalities::default().execute_with(|| {
|
||||
const BUFFER_SIZE: usize = 300;
|
||||
// Ensure that the capacity isn't dividable by `300`.
|
||||
assert!(!STORAGE_INPUT_BUFFER_CAPACITY.is_multiple_of(BUFFER_SIZE), "Please update buffer size");
|
||||
assert!(
|
||||
!STORAGE_INPUT_BUFFER_CAPACITY.is_multiple_of(BUFFER_SIZE),
|
||||
"Please update buffer size"
|
||||
);
|
||||
// Create some items where the last item is partially in the inner buffer so that
|
||||
// we need to fill the buffer to read the entire item.
|
||||
let data: Vec<Vec<u8>> = (0..=(STORAGE_INPUT_BUFFER_CAPACITY / BUFFER_SIZE))
|
||||
@@ -640,7 +643,10 @@ mod tests {
|
||||
|
||||
const BUFFER_SIZE: usize = 300;
|
||||
// Ensure that the capacity isn't dividable by `300`.
|
||||
assert!(!STORAGE_INPUT_BUFFER_CAPACITY.is_multiple_of(BUFFER_SIZE), "Please update buffer size");
|
||||
assert!(
|
||||
!STORAGE_INPUT_BUFFER_CAPACITY.is_multiple_of(BUFFER_SIZE),
|
||||
"Please update buffer size"
|
||||
);
|
||||
// Create some items where the last item is partially in the inner buffer so that
|
||||
// we need to fill the buffer to read the entire item.
|
||||
let data: Vec<Vec<u8>> = (0..=(STORAGE_INPUT_BUFFER_CAPACITY / BUFFER_SIZE))
|
||||
|
||||
@@ -1389,9 +1389,9 @@ mod test {
|
||||
let _ = A::clear(u32::max_value(), None);
|
||||
// one of the item has been removed
|
||||
assert!(
|
||||
!A::contains_key((2, 20, 200)) &&
|
||||
!A::contains_key((3, 30, 300)) &&
|
||||
!A::contains_key((4, 40, 400))
|
||||
!A::contains_key((2, 20, 200))
|
||||
&& !A::contains_key((3, 30, 300))
|
||||
&& !A::contains_key((4, 40, 400))
|
||||
);
|
||||
assert_eq!(A::count(), 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user