Skip to content

Commit

Permalink
fix clippy error
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh committed Nov 2, 2023
1 parent e4e480f commit 0c9375a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 1 addition & 5 deletions parachain/pallets/control/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@ where
pub struct AllowSiblingsOnly;
impl Contains<MultiLocation> for AllowSiblingsOnly {
fn contains(location: &MultiLocation) -> bool {
if let MultiLocation { parents: 1, interior: X1(Parachain(_)) } = location {
true
} else {
false
}
matches!(location, MultiLocation { parents: 1, interior: X1(Parachain(_)) })
}
}

Expand Down
10 changes: 10 additions & 0 deletions parachain/pallets/control/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,3 +581,13 @@ fn charge_fee_for_upgrade() {
assert_eq!(sovereign_balance, InitialFunding::get());
});
}

#[test]
fn allow_siblings_predicate_only_allows_siblings() {
new_test_ext().execute_with(|| {
let sibling = MultiLocation::new(1, X1(Parachain(1000)));
let child = MultiLocation::new(0, X1(Parachain(1000)));
assert!(AllowSiblingsOnly::contains(&sibling), "Sibling returns true.");
assert!(!AllowSiblingsOnly::contains(&child), "Child returns false.");
});
}

0 comments on commit 0c9375a

Please sign in to comment.