Closed HashWarlock closed 2 years ago
In the current code we have examples where we use drain_prefix and run a for loop on the iterator without doing anything.
drain_prefix
Here is an example of this on line 319: https://github.com/rmrk-team/rmrk-substrate/blob/ead0e1e8c64ec00518f9472b0facd05c4a010743/pallets/rmrk-core/src/functions.rs#L319 Instead we can change it to this and avoid iterating through the Resources:
Resources::<T>::remove_prefix((collection_id, nft_id), None);
Suggestion to remove all instances where we iterate through the drain_prefix Iterator & replace with remove_prefix to avoid unnecessary iteration.
remove_prefix
https://github.com/rmrk-team/rmrk-substrate/pull/135 look good?
In the current code we have examples where we use
drain_prefix
and run a for loop on the iterator without doing anything.Here is an example of this on line 319: https://github.com/rmrk-team/rmrk-substrate/blob/ead0e1e8c64ec00518f9472b0facd05c4a010743/pallets/rmrk-core/src/functions.rs#L319 Instead we can change it to this and avoid iterating through the Resources:
Suggestion to remove all instances where we iterate through the
drain_prefix
Iterator & replace withremove_prefix
to avoid unnecessary iteration.