@@ -341,7 +341,7 @@ impl<T: Config> Pallet<T> {
341341 Self :: set_parentkeys ( pivot. clone ( ) , netuid, new_parents_vec. clone ( ) ) ;
342342
343343 let prev_parents_set: BTreeSet < T :: AccountId > =
344- prev_parents_vec. iter ( ) . map ( |( _, p) | p. clone ( ) ) . collect ( ) ;
344+ prev_parents_vec. into_iter ( ) . map ( |( _, p) | p) . collect ( ) ;
345345 let new_parents_set: BTreeSet < T :: AccountId > = new_parents_map. keys ( ) . cloned ( ) . collect ( ) ;
346346
347347 // Added parents = new / prev => ensure ChildKeys(parent) has (p, pivot)
@@ -361,12 +361,11 @@ impl<T: Config> Pallet<T> {
361361
362362 // Updated parents = intersection where proportion changed
363363 for common in new_parents_set. intersection ( & prev_parents_set) {
364- let new_p = match new_parents_map. get ( common) {
365- Some ( p) => * p,
366- None => return Err ( Error :: < T > :: ChildParentInconsistency . into ( ) ) ,
367- } ;
364+ let new_p = new_parents_map
365+ . get ( common)
366+ . ok_or ( Error :: < T > :: ChildParentInconsistency ) ?;
368367 let mut ck = ChildKeys :: < T > :: get ( common. clone ( ) , netuid) ;
369- PCRelations :: < T > :: upsert_edge ( & mut ck, new_p, & pivot) ;
368+ PCRelations :: < T > :: upsert_edge ( & mut ck, * new_p, & pivot) ;
370369 Self :: set_childkeys ( common. clone ( ) , netuid, ck) ;
371370 weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads_writes ( 1 , 1 ) ) ;
372371 }
0 commit comments