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:
@@ -420,8 +420,8 @@ where
|
||||
// not a descendant of `hash`.
|
||||
let children = std::mem::take(&mut curr.children);
|
||||
for child in children {
|
||||
if child.number == *number && child.hash == *hash ||
|
||||
*number < child.number && is_descendent_of(hash, &child.hash)?
|
||||
if child.number == *number && child.hash == *hash
|
||||
|| *number < child.number && is_descendent_of(hash, &child.hash)?
|
||||
{
|
||||
curr.children.push(child);
|
||||
} else {
|
||||
@@ -544,9 +544,10 @@ where
|
||||
let is_finalized = root.hash == *hash;
|
||||
let is_descendant =
|
||||
!is_finalized && root.number > number && is_descendent_of(hash, &root.hash)?;
|
||||
let is_ancestor = !is_finalized &&
|
||||
!is_descendant && root.number < number &&
|
||||
is_descendent_of(&root.hash, hash)?;
|
||||
let is_ancestor = !is_finalized
|
||||
&& !is_descendant
|
||||
&& root.number < number
|
||||
&& is_descendent_of(&root.hash, hash)?;
|
||||
(is_finalized, is_descendant, is_ancestor)
|
||||
};
|
||||
|
||||
@@ -617,8 +618,8 @@ where
|
||||
if predicate(&node.data) && (node.hash == *hash || is_descendent_of(&node.hash, hash)?)
|
||||
{
|
||||
for child in node.children.iter() {
|
||||
if child.number <= number &&
|
||||
(child.hash == *hash || is_descendent_of(&child.hash, hash)?)
|
||||
if child.number <= number
|
||||
&& (child.hash == *hash || is_descendent_of(&child.hash, hash)?)
|
||||
{
|
||||
return Err(Error::UnfinalizedAncestor);
|
||||
}
|
||||
@@ -664,8 +665,8 @@ where
|
||||
if predicate(&root.data) && (root.hash == *hash || is_descendent_of(&root.hash, hash)?)
|
||||
{
|
||||
for child in root.children.iter() {
|
||||
if child.number <= number &&
|
||||
(child.hash == *hash || is_descendent_of(&child.hash, hash)?)
|
||||
if child.number <= number
|
||||
&& (child.hash == *hash || is_descendent_of(&child.hash, hash)?)
|
||||
{
|
||||
return Err(Error::UnfinalizedAncestor);
|
||||
}
|
||||
@@ -692,9 +693,9 @@ where
|
||||
let roots = std::mem::take(&mut self.roots);
|
||||
|
||||
for root in roots {
|
||||
let retain = root.number > number && is_descendent_of(hash, &root.hash)? ||
|
||||
root.number == number && root.hash == *hash ||
|
||||
is_descendent_of(&root.hash, hash)?;
|
||||
let retain = root.number > number && is_descendent_of(hash, &root.hash)?
|
||||
|| root.number == number && root.hash == *hash
|
||||
|| is_descendent_of(&root.hash, hash)?;
|
||||
|
||||
if retain {
|
||||
self.roots.push(root);
|
||||
@@ -1162,15 +1163,15 @@ mod test {
|
||||
// finalizing "D" will finalize a block from the tree, but it can't be applied yet
|
||||
// since it is not a root change.
|
||||
assert_eq!(
|
||||
tree.finalizes_any_with_descendent_if(&"D", 10, &is_descendent_of, |c| c.effective ==
|
||||
10),
|
||||
tree.finalizes_any_with_descendent_if(&"D", 10, &is_descendent_of, |c| c.effective
|
||||
== 10),
|
||||
Ok(Some(false)),
|
||||
);
|
||||
|
||||
// finalizing "E" is not allowed since there are not finalized ancestors.
|
||||
assert_eq!(
|
||||
tree.finalizes_any_with_descendent_if(&"E", 15, &is_descendent_of, |c| c.effective ==
|
||||
10),
|
||||
tree.finalizes_any_with_descendent_if(&"E", 15, &is_descendent_of, |c| c.effective
|
||||
== 10),
|
||||
Err(Error::UnfinalizedAncestor)
|
||||
);
|
||||
|
||||
@@ -1203,15 +1204,15 @@ mod test {
|
||||
|
||||
// finalizing "F" will fail since it would finalize past "E" without finalizing "D" first
|
||||
assert_eq!(
|
||||
tree.finalizes_any_with_descendent_if(&"F", 100, &is_descendent_of, |c| c.effective <=
|
||||
100,),
|
||||
tree.finalizes_any_with_descendent_if(&"F", 100, &is_descendent_of, |c| c.effective
|
||||
<= 100,),
|
||||
Err(Error::UnfinalizedAncestor),
|
||||
);
|
||||
|
||||
// it will work with "G" though since it is not in the same branch as "E"
|
||||
assert_eq!(
|
||||
tree.finalizes_any_with_descendent_if(&"G", 100, &is_descendent_of, |c| c.effective <=
|
||||
100),
|
||||
tree.finalizes_any_with_descendent_if(&"G", 100, &is_descendent_of, |c| c.effective
|
||||
<= 100),
|
||||
Ok(Some(true)),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user