mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Minor improvements to bounded_vec and defensive. (#10873)
* Fix a few things in bounded_vec * add test for try_extend * Update frame/support/src/storage/bounded_vec.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * some review comments * use swap * remove clone * use pop instead of truncate * remove warn * review comments * Update frame/support/src/storage/bounded_vec.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * fix rustdoc * fix links * undo link Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -866,7 +866,7 @@ impl<T: Config> Pallet<T> {
|
||||
let new_pos = queue.binary_search_by_key(&ayes, |x| x.1).unwrap_or_else(|x| x);
|
||||
branch = if maybe_old_pos.is_none() && new_pos > 0 {
|
||||
// Just insert.
|
||||
queue.force_insert_keep_right(new_pos, (index, ayes));
|
||||
let _ = queue.force_insert_keep_right(new_pos, (index, ayes));
|
||||
ServiceBranch::RequeuedInsertion
|
||||
} else if let Some(old_pos) = maybe_old_pos {
|
||||
// We were in the queue - slide into the correct position.
|
||||
|
||||
@@ -86,7 +86,7 @@ impl<T: Ord, S: Get<u32>> InsertSorted<T> for BoundedVec<T, S> {
|
||||
mut f: F,
|
||||
) -> bool {
|
||||
let index = self.binary_search_by_key::<K, F>(&f(&t), f).unwrap_or_else(|x| x);
|
||||
self.force_insert_keep_right(index, t)
|
||||
self.force_insert_keep_right(index, t).is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user