diff --git a/CHANGELOG.md b/CHANGELOG.md index d522b1fa9ed..125dfa392b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,8 +28,10 @@ protocol for future versions of Polkadot. - Introduce conditional compilation for messages, constructors and events ‒ [#1458](https://github.com/paritytech/ink/pull/1458) - Add `Mapping::take()` function allowing to get a value removing it from storage ‒ [#1461](https://github.com/paritytech/ink/pull/1461) + ### Changed - Update `scale-info` requirement to `2.3` ‒ [#1467](https://github.com/paritytech/ink/pull/1467) +- Merge `Mapping::insert(key, val)` and `Mapping::insert_return_size(key, val)` into one method - [#1463](https://github.com/paritytech/ink/pull/1463) ### Removed - Remove `ink_env::random` function ‒ [#1442](https://github.com/paritytech/ink/pull/1442) diff --git a/crates/storage/src/lazy/mapping.rs b/crates/storage/src/lazy/mapping.rs index 11634aa1c3d..88e77617754 100644 --- a/crates/storage/src/lazy/mapping.rs +++ b/crates/storage/src/lazy/mapping.rs @@ -130,21 +130,11 @@ where V: Packed, KeyType: StorageKey, { - /// Insert the given `value` to the contract storage. - #[inline] - pub fn insert(&mut self, key: Q, value: &R) - where - Q: scale::EncodeLike, - R: Storable + scale::EncodeLike, - { - ink_env::set_contract_storage(&(&KeyType::KEY, key), value); - } - /// Insert the given `value` to the contract storage. /// - /// Returns the size of the pre-existing value at the specified key if any. + /// Returns the size in bytes of the pre-existing value at the specified key if any. #[inline] - pub fn insert_return_size(&mut self, key: Q, value: &R) -> Option + pub fn insert(&mut self, key: Q, value: &R) -> Option where Q: scale::EncodeLike, R: Storable + scale::EncodeLike,