Skip to content

Commit

Permalink
chore: nicer duplicates fn
Browse files Browse the repository at this point in the history
  • Loading branch information
YourUsername committed Aug 23, 2024
1 parent 679c5a5 commit 07989e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pallets/subspace/src/set_weights.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::*;
use frame_support::pallet_prelude::DispatchResult;
use pallet_subnet_emission_api::SubnetConsensus;
use sp_std::collections::btree_set::BTreeSet;

impl<T: Config> Pallet<T> {
/// Sets weights for a node in a specific subnet.
Expand Down Expand Up @@ -129,8 +130,7 @@ impl<T: Config> Pallet<T> {

#[must_use]
fn contains_duplicates(items: &[u16]) -> bool {
let mut seen = sp_std::collections::btree_set::BTreeSet::new();
items.iter().any(|item| !seen.insert(item))
items.len() > BTreeSet::from_iter(items.iter()).len()
}

pub fn perform_uid_validity_check(uids: &[u16], netuid: u16) -> DispatchResult {
Expand Down

0 comments on commit 07989e5

Please sign in to comment.